liamloveslearning Posted May 27, 2010 Share Posted May 27, 2010 Hi everybody, I need to upload 26 photos to a folder and insert the filenames into a table, Ive no idea how to do this so has anybody got any tutorials or advise me on how its done? Is it fairly simple or does it use a looper region? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted May 27, 2010 Share Posted May 27, 2010 Upload them using your favorite FTP or SFTP program. In your script use the glob function to get the filenames into an array. From there just perform a loop to add them into your database. Ken Quote Link to comment Share on other sites More sharing options...
ChaosKnight Posted May 28, 2010 Share Posted May 28, 2010 You can have a look at how I solved my problem: http://www.phpfreaks.com/forums/index.php/topic,299376.0.html, it's not perfect, but it'll get you started... Just make sure you have permissions to upload into that folder... You can also take a look at the PHP Manual, just search for multiple file upload... Quote Link to comment Share on other sites More sharing options...
jdavidbakr Posted May 28, 2010 Share Posted May 28, 2010 I've used http://swfupload/ quite a bit - if you're needing this to be something that you'll do on a regular basis and want to have some automation in the processing, or if and end-user will be doing these uploads, I'd recommend it. It allows you to upload multiple images at a time, gives you the ability to display a progress bar as they are uploading, and delivers them one at a time to your PHP script. You need to work with the javascript but you technically can use the sample codes to get a pretty decent uploader. Quote Link to comment Share on other sites More sharing options...
r.osmanov Posted May 29, 2010 Share Posted May 29, 2010 Should be something like <form method="post" target="server" action="upload.php" enctype="multipart/form-data"> <div>file1: <input size="50" type="file" name="files[]" /> </div> <div>file2: <input size="50" type="file" name="files[]" /> </div> <div>file3: <input size="50" type="file" name="files[]" /> </div> ... <input type="submit" value="upload" /> </form> # upload.php for($i=0, $n=count($_FILES['files']['name']);$i<$n;++$i){ if (false == my_upload_file($_FILES['files']['tmp_name'][$i], ...)){ error_log($_FILES['files']['error'][$i]); } } You should also check if e.g. $_FILES['files']['name'] is array Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.