BleepingComputer.com: File uploader with progress bar

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

File uploader with progress bar

#1 User is offline   KamakaZ 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 557
  • Joined: 26-August 08
  • Gender:Male
  • Location:Victoria

Posted 14 December 2009 - 08:04 AM

Must be one of those days... I have litterally spent a whole night crawling the web trying to find a decent bit of code/tutorial that will upload a single or, multiple files to a specified directory and block out the nasties such as .exe .php etc... i have been through php, ajax/javascript, flash, cold fusion and a few other languages, but can't find one that matches what i want to do.

I'm looking to upload multiple .mp3's that run for approx 1 hour each, so i need to take file size into account also. I have stumbled upon adobe flex/xml which looks like it can do that job but can't seem to get any examples to even display (white pages)(would like to use php if possible as i'm looking to put a php login screen before the uploader).

Found a few that use perl, which is not an option for me. Can't seem to find a decent tutorial anywhere on the internet, so i have found myself here blabbing on again. Have just come across this code which i'd like to use, but how would i add a progress bar on it? be it ajax, flash whatever!

Sorry for the ranting above, am just very frustrated with this project at the moment... So if you can decifer any of the above and might be able to help, i bow down to you :thumbsup:

~ Goodnight, Kam
If I am helping you and don't reply in 24 hours please send me a PM

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.

#2 User is offline   techextreme 

  • Bleepin Tech
  • PipPipPipPipPipPip
  • Find Topics
  • Group: BC Advisor
  • Posts: 2,097
  • Joined: 09-June 09
  • Gender:Male
  • Location:Pittsburgh, PA

Posted 14 December 2009 - 09:54 AM

I don't know if this is exactly what you're looking for, but it's worth a try.

http://blog.liip.ch/archive/2006/09/10/upl...or-php-5-2.html
Techextreme

"Admire those who attempt great things, even though they fail."

-- Seneca

Member of the Bleeping Computer A.I.I. early response team!

#3 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,605
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 14 December 2009 - 10:09 AM

HTML has a built in file chooser. http://www.cs.tut.fi/~jkorpela/forms/file.html.. If you want to do verification of file size and extension, you use javascript form validation. When the submit button is clicked on the form, you call your javascript. Here is an example with javascript and a sample form. There is a bit of a difference though. When you are doing validation, the file chooser holds an array of values, so you need to loop through the values one by one, then check their file size (using myfile.size), and check their extension. Here is one example of checking file extension. Here is another.

If you want to use a progress bar, then you will need to do asynchronous uploads (ajax) because otherwise while the browser is uploading files or doing anything else, it is locked from anything else happening. File uploads with Ajax is not too bad as long as you use a pre-built library. I have another post on here somewhere that explains how to use the YUI libraries. Incidentally, the YUI library has a file uploader that uses Flash, and it is pretty painless to use.

Once the files are uploaded, your php again needs to check the extension and file size. Using a debugger I can rewrite javascript on the fly, and I could rewrite your javascript validation function to accept any file that I want. If there is no validation on the server, I could use your server to store any file that I want. ;)
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users