Hi all. I need to incorporate file uploads into my website, and after a few hours of thinking I came up with a pretty good way I think.
The page with the upload form will be served by a front end web server. To make sure it uploads the file to my remote storage server I'll do this in the markup:
<form action="http://storage.mysite.com/upload.php">
<!-- whatever -->
</form>
So that's that handled, but that makes things like a tad more complicated. I also wanted a progress bar for the upload, and I think I came up with a way to do that too. Check out my awesome Photoshop skills explaining it:
To get the progress of the uploaded file, I was going to use the PHP function filesize();
to get the filesize of the file as it's being uploaded. If I have that and the total filezsize I can work it out using Javascript and update the page. But I don't know how to get the total filesize of the upload either :P
Then when the upload is finished I can check the filesize again and if it's the same as the total filesize I know the upload is finished. Then I can run a Javascript function to update the page with the download URL and everything else.
Anyway that's how I'm planning to do it. I don't want to use any fancy flash stuff as I don't want to rely on my users having flash installed. Does anyone who has done something simular or have experience in doing this lend some advice and let me know if I'm going about it the right way?
Thanks, much appreciated.