To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > PHP Help > Upgrading PHP

Upgrading PHP Issues concerning PHP version upgrades and future releases

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-30-2004, 09:30 PM   #1
sneakyimp
Senior Member
 
Join Date: Apr 2003
Location: LA
Posts: 3,208
upload progress???

one of the most annoying features about PHP 4 is the fact that there's no way to keep a client apprised of the status of their upload. you just have to wait and hope that the upload is working. this is very annoying for large files (like mp3 files, for instance).

will PHP 5 offer something to address this problem??
sneakyimp is offline   Reply With Quote
Old 07-30-2004, 09:34 PM   #2
planetsim
code | beer > sleep
 
Join Date: Sep 2002
Location: aus
Posts: 4,826
No and PHP probably never will. This has got a few reasons.

Firstly PHP is server side language which means once the PHP has been parsed and the output sent out to the client PHP stops there it doesnt do anymore work. Until the user has more interaction say they upload a file in your case. Once they upload the file PHP recieves the file and doesnt know anything about it until its fully uploaded to the server then it can start doing something with that file.

For what you may want to do is once they click submit have something like Uploading.. appear on the screen or something like that. Once its finished uploading the new page will then be displayed.
__________________
Dont be lazy Search
And use the Manual
Webmobo - Open Source News Script | Portfolio / Blog | Against TCPA
planetsim is offline   Reply With Quote
Old 07-30-2004, 10:06 PM   #3
sneakyimp
Senior Member
 
Join Date: Apr 2003
Location: LA
Posts: 3,208
Let's call this PHP's critical weakness than...that it doesn't try to do just a *little more*.

ASP supports something like this...it doesn't require controls or applets...

http://support.persits.com/upload/progress.asp

also, there appears to be some kind of PHP solution that involves some PERL code:

http://www.raditha.com/php/progress.php

please don't be so dismissive of my post here...it's REALLY ANNOYING to not have an upload progress bar.
sneakyimp is offline   Reply With Quote
Old 07-30-2004, 11:41 PM   #4
planetsim
code | beer > sleep
 
Join Date: Sep 2002
Location: aus
Posts: 4,826
Will ASP basic install doesnt actually do that from what ive seen you require 3rd party software to allow ASP to do it. From what i saw in the Progress Bar for PHP it was mainly Perl doing to core of the work.

I also wasnt being dismissive there just is no inbuilt way to do it.

You may think its annoying but at the end of the day its mainly a security issue of having access to the clients hdd information and such as the File Size information i wouldnt want that.

Also as a PHP critical weakness it cant be a weakness if it doesnt support it, its a limitation every single programming language has it. ASP has a limitation that you require 3rd party software to do some simple things that are inbuilt into PHP.
__________________
Dont be lazy Search
And use the Manual
Webmobo - Open Source News Script | Portfolio / Blog | Against TCPA
planetsim is offline   Reply With Quote
Old 08-02-2004, 06:16 PM   #5
sneakyimp
Senior Member
 
Join Date: Apr 2003
Location: LA
Posts: 3,208
the security hazard hadn't ocurred to me. that's a good point. however, i believe that the server is going to know how large the file is as soon as it has exchanged the proper headers with the server, no? i don't know the details of the upload protocol, but i imagine that the server needs to allocate the proper amount of space for the upload.

as for the ASP solution requiring 3rd party...is microsoft considered 3rd party? i have my browser security settings set very high for strange pages...i'm prompted for any activeX or applet activity. i didn't even get a prompt on that page.

furthermore, i just read the ASP code. it all looks like native asp to me...unless perhaps there is some kind of server side mod or library (fath.*?)

Set oUpload = Server.CreateObject("Fath.Upload")

ultimately, the upload progress thing is a very useful piece of functionality...would be nice to have it. I personally would be much more inclined to trust something offered and sanctioned by the PHP development crew than any 3rd party utilities or even microsoft for that matter.

Last edited by sneakyimp; 08-02-2004 at 06:18 PM.
sneakyimp is offline   Reply With Quote
Old 08-02-2004, 06:25 PM   #6
planetsim
code | beer > sleep
 
Join Date: Sep 2002
Location: aus
Posts: 4,826
Well what i said about it being a 3rd party software i heard from a friend as i dont know ASP at all so im going to just have to agree that its built in as I dont know personally.

Secondly the way upload works in PHP is probably much different then with ASP.

The way PHP works with file upload is probably much different then asps implementation. PHP doesnt know much about the file until its already on the server. Once its there it can do what its likes but in the middle it doesnt have much idea on what is happening.
__________________
Dont be lazy Search
And use the Manual
Webmobo - Open Source News Script | Portfolio / Blog | Against TCPA
planetsim is offline   Reply With Quote
Old 08-02-2004, 06:29 PM   #7
sneakyimp
Senior Member
 
Join Date: Apr 2003
Location: LA
Posts: 3,208
i went kicking around on that site with the ASP example. They're selling a product called aspUpload...so i guess it *might* be 3rd party. I'm pretty sure it's all server-side, though. like i said, i tested the page with super high security settings. If any extra security hazard stuff was running (above and beyond the awful security hazard that is IE 6), i should have been notified.

such a bummer! grrrrrr.
sneakyimp is offline   Reply With Quote
Old 08-02-2004, 06:44 PM   #8
planetsim
code | beer > sleep
 
Join Date: Sep 2002
Location: aus
Posts: 4,826
If you really require it why not look at the PHP/Perl implemenation. Also this maybe better situated in the Coding or General forum now
__________________
Dont be lazy Search
And use the Manual
Webmobo - Open Source News Script | Portfolio / Blog | Against TCPA
planetsim is offline   Reply With Quote
Old 08-02-2004, 07:06 PM   #9
drew010
Senior Member
 
drew010's Avatar
 
Join Date: Apr 2003
Location: Santa Rosa, CA
Posts: 2,835
yes, the asp solution is a 3rd party solution.

Set oUpload = Server.CreateObject("Fath.Upload")

creates an object from that class. they may sell a compiled version of the or sell the source, but a default install of asp will not work unless you download and install that class file to your system dir.
drew010 is offline   Reply With Quote
Old 08-02-2004, 07:15 PM   #10
sneakyimp
Senior Member
 
Join Date: Apr 2003
Location: LA
Posts: 3,208
thanks, guys.
sneakyimp is offline   Reply With Quote
Old 08-03-2004, 11:33 AM   #11
goldbug
50,000 Watts of Goodwill
 
goldbug's Avatar
 
Join Date: May 2003
Location: Rummaging through your garbage.
Posts: 1,326
Just FYI, *most* times you see ASP uploading, it's a 3rd party com object (often aspSmartUpload). However, it's quite possible to do it purely with ASP/VBscript code (that's what I use), it's just not pretty.
__________________
Many eyes make few mistakes

goldendance
goldbug is offline   Reply With Quote
Old 08-06-2004, 03:52 PM   #12
nuying117
Junior Member
 
nuying117's Avatar
 
Join Date: Feb 2004
Location: Hangzhou,China
Posts: 22
I think may be we can use the 3rd party software through function COM(),if ur php is installed under win32.

the 3rd party software used in asp is very conveninent,i think.
__________________
http://www.x117.net
nuying117 is offline   Reply With Quote
Old 08-06-2004, 08:20 PM   #13
planetsim
code | beer > sleep
 
Join Date: Sep 2002
Location: aus
Posts: 4,826
Just remember that the majority of PHP webhosts are on Linux the COM functions will be useless then
__________________
Dont be lazy Search
And use the Manual
Webmobo - Open Source News Script | Portfolio / Blog | Against TCPA
planetsim is offline   Reply With Quote
Old 09-09-2005, 01:23 PM   #14
ChaosCaptain
To Infinity and Beyond
 
Join Date: Sep 2005
Location: Phx, AZ
Posts: 1
resolved

I have extended Doru Theodor Petrescu's patch, so that it uses a MySQL database to log the upload progress data, instead of in a file. Source code and demo available here:

http://www.modphp.org/ftopic324.php

Also, I have a demo and source code for using XAJAX to provide the upload progress bar inline.

Basically, what it is: a patch to the source code of PHP. You must patch the PHP source code and recompile. The patch allows you to define, in apache's httpd.conf file, a MySQL host,user,pass,dbname to log upload data to. Each upload is a new row in the table, this row gets updated over and over again during the upload.
The database needs to have this configuration:
Code:
CREATE TABLE `uploadbar` (
  `id` varchar(32) NOT NULL default '',
  `time_start` int(11) NOT NULL default '0',
  `time_last` int(11) NOT NULL default '0',
  `speed_average` int(11) NOT NULL default '0',
  `speed_last` int(11) NOT NULL default '0',
  `bytes_uploaded` int(11) NOT NULL default '0',
  `bytes_total` int(11) NOT NULL default '0',
  `files_uploaded` int(11) NOT NULL default '0',
  `eta` int(11) NOT NULL default '0',
  `last_touched` timestamp(14) NOT NULL,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM;
The patched PHP module will then log data to this MySQL table while the upload is occuring. So, while you have one process uploading, you can have another processing checking the contents of the row in this table over and over again, therefore obtaining the status of the upload.

Visit my site for the full details: http://www.modphp.org/ftopic324.php
ChaosCaptain is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 06:50 AM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.