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??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.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...
<!-- m --><a class="postlink" href="http://support.persits.com/upload/progress.asp">http://support.persits.com/upload/progress.asp</a><!-- m -->
also, there appears to be some kind of PHP solution that involves some PERL code:
<!-- m --><a class="postlink" href="http://www.raditha.com/php/progress.php">http://www.raditha.com/php/progress.php</a><!-- m -->
please don't be so dismissive of my post here...it's REALLY ANNOYING to not have an upload progress bar.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.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.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.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.If you really require it why not look at the PHP/Perl implemenation. Also this maybe better situated in the Coding or General forum nowyes, 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.thanks, guys.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.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.Just remember that the majority of PHP webhosts are on Linux the COM functions will be useless thenI 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:
<!-- m --><a class="postlink" href="http://www.modphp.org/ftopic324.php">http://www.modphp.org/ftopic324.php</a><!-- m -->
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:
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: <!-- m --><a class="postlink" href="http://www.modphp.org/ftopic324.php">http://www.modphp.org/ftopic324.php</a><!-- m -->
will PHP 5 offer something to address this problem??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.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...
<!-- m --><a class="postlink" href="http://support.persits.com/upload/progress.asp">http://support.persits.com/upload/progress.asp</a><!-- m -->
also, there appears to be some kind of PHP solution that involves some PERL code:
<!-- m --><a class="postlink" href="http://www.raditha.com/php/progress.php">http://www.raditha.com/php/progress.php</a><!-- m -->
please don't be so dismissive of my post here...it's REALLY ANNOYING to not have an upload progress bar.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.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.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.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.If you really require it why not look at the PHP/Perl implemenation. Also this maybe better situated in the Coding or General forum nowyes, 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.thanks, guys.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.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.Just remember that the majority of PHP webhosts are on Linux the COM functions will be useless thenI 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:
<!-- m --><a class="postlink" href="http://www.modphp.org/ftopic324.php">http://www.modphp.org/ftopic324.php</a><!-- m -->
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:
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: <!-- m --><a class="postlink" href="http://www.modphp.org/ftopic324.php">http://www.modphp.org/ftopic324.php</a><!-- m -->