Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

File uploader with progress bar


  • Please log in to reply
2 replies to this topic

#1 KamakaZ

KamakaZ

  • Members
  • 739 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Victoria
  • Local time:05:01 AM

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

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.


BC AdBot (Login to Remove)

 


#2 techextreme

techextreme

    Bleepin Tech


  • Members
  • 2,125 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Pittsburgh, PA
  • Local time:02:01 PM

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

#3 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:12:01 PM

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. ;)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users