Dynamic Uploads - PHP?
Discussion
Hello,
I'm wondering if anyone can help. I'm writing a little page for my site which, when pointed to a directory on my hdd will upload all the images to the server and add some stuff to my db.
I can upload a single file quite successfully but can't produce a list of the files on my hdd. I appreciate that this will all be to do with security, but is there anyway I can get a list of all the image files dynamically? Or rather copy an entire directory and it's structure to the remote server?
I've just thought of a possible (messy) solution, it would involve me hosting a file on my PC using IIS and allowing the remote server to contact it for a return variable of some description. Another option would be to post the list of files myself into a text box, but I really wanted it dynamically done.
I've been searching all afternoon and I'm frustrated, all I can find is singular upload systems (albeit it with multiple entries), is there anyway to do this?
Cheers
I'm wondering if anyone can help. I'm writing a little page for my site which, when pointed to a directory on my hdd will upload all the images to the server and add some stuff to my db.
I can upload a single file quite successfully but can't produce a list of the files on my hdd. I appreciate that this will all be to do with security, but is there anyway I can get a list of all the image files dynamically? Or rather copy an entire directory and it's structure to the remote server?
I've just thought of a possible (messy) solution, it would involve me hosting a file on my PC using IIS and allowing the remote server to contact it for a return variable of some description. Another option would be to post the list of files myself into a text box, but I really wanted it dynamically done.
I've been searching all afternoon and I'm frustrated, all I can find is singular upload systems (albeit it with multiple entries), is there anyway to do this?
Cheers
You've probably already found this link in your searches http://uk.php.net/readdir there's quite a few code snippets for various tasks.
I'm not entirely sure what environments you're working with, you mention PHP?
I'm not entirely sure what environments you're working with, you mention PHP?
Ok I kindda see what you're trying to do now. When you've successfully uploaded the file (the one you mentioned in your original post), I'm guessing you're running some client side code to do it, or at least get the file??? I thought you were connecting to your hard drive somehow via the server.
oh, sorry. Let me explain in a bit more detail:
I take lots of pictures and as such I want to share with my family and friends and keep a nice tidy record for myself to lookup pics from trip xxx.
The site that is on my profile did this nicely, although it uses flat text files as storage, and was very fiddily to update (resize the images and make the thumbnails, create a list of them all using dir command, modify my array of entries-PHP file and upload the whole lot using 2 seperate servers). Now that I'm using a new server, with a domain name and all, I am making a more robust system using mySQL to store filenames and album titles and what-have ya.
Instead of updating this all manually, I want to do it as easily as possible. The way I am investigating at the moment is thus:
1. Give a form the location of the folder to upload, also give a folder name (album name) and a location to upload to.
2. Have the PHP compile a list of all the image files contiained within said folder on my local harddrive.
3. Upload (via an interim form as images need to done via seperate form so I'm told).
4. On upload update my db with various data needed by the site so that it updates itself.
I already have the viewing system installed, it creates thumbnail tables, descriptions et al on the fly (the thumbnails are already there), I just want to automate the background tasks as well.
All I need is to get PHP on the remote server, to list the contents of a directory, or a command to copy a directory from my hard-drive to the remote server. Does that make more sense? Finding it hard to explain to myself never mind someone else if the truth be told.
I take lots of pictures and as such I want to share with my family and friends and keep a nice tidy record for myself to lookup pics from trip xxx.
The site that is on my profile did this nicely, although it uses flat text files as storage, and was very fiddily to update (resize the images and make the thumbnails, create a list of them all using dir command, modify my array of entries-PHP file and upload the whole lot using 2 seperate servers). Now that I'm using a new server, with a domain name and all, I am making a more robust system using mySQL to store filenames and album titles and what-have ya.
Instead of updating this all manually, I want to do it as easily as possible. The way I am investigating at the moment is thus:
1. Give a form the location of the folder to upload, also give a folder name (album name) and a location to upload to.
2. Have the PHP compile a list of all the image files contiained within said folder on my local harddrive.
3. Upload (via an interim form as images need to done via seperate form so I'm told).
4. On upload update my db with various data needed by the site so that it updates itself.
I already have the viewing system installed, it creates thumbnail tables, descriptions et al on the fly (the thumbnails are already there), I just want to automate the background tasks as well.
All I need is to get PHP on the remote server, to list the contents of a directory, or a command to copy a directory from my hard-drive to the remote server. Does that make more sense? Finding it hard to explain to myself never mind someone else if the truth be told.
docevi1 said:
oh, sorry. Let me explain in a bit more detail:
I take lots of pictures and as such I want to share with my family and friends and keep a nice tidy record for myself to lookup pics from trip xxx.
The site that is on my profile did this nicely, although it uses flat text files as storage, and was very fiddily to update (resize the images and make the thumbnails, create a list of them all using dir command, modify my array of entries-PHP file and upload the whole lot using 2 seperate servers). Now that I'm using a new server, with a domain name and all, I am making a more robust system using mySQL to store filenames and album titles and what-have ya.
Instead of updating this all manually, I want to do it as easily as possible. The way I am investigating at the moment is thus:
1. Give a form the location of the folder to upload, also give a folder name (album name) and a location to upload to.
2. Have the PHP compile a list of all the image files contiained within said folder on my local harddrive.
3. Upload (via an interim form as images need to done via seperate form so I'm told).
4. On upload update my db with various data needed by the site so that it updates itself.
I already have the viewing system installed, it creates thumbnail tables, descriptions et al on the fly (the thumbnails are already there), I just want to automate the background tasks as well.
All I need is to get PHP on the remote server, to list the contents of a directory, or a command to copy a directory from my hard-drive to the remote server. Does that make more sense? Finding it hard to explain to myself never mind someone else if the truth be told.
Sorry really must dash in a mo but can't you just create the folders on yer hard drive and ftp the folder via drag and drop(cuteftp or explorer will do it), ok so you still need to update the database but this is a bit simpler. You could then poss run the PHP scripts in the previous link to poss update the db. Just an idea I'm sure there's a more automated way of doing it.
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


