This is a discussion on Uploading multiple files... within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I'll admit that I haven't looked too hard just yet on this one, but wondered if the group ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'll admit that I haven't looked too hard just yet on this one, but wondered
if the group might have a quick answer. Is it possible to use PHP to upload multiple files from a client? And what I'm thinking is for the client to choose one local folder and for the script would upload every file in that folder that matches a file mask (*.jpg specifically). It's for my photo album and at present I FTP the files to an import folder and run my scripts from there that resize and insert into my SQL database. If I can make it one step though, that would be great. I've seen many JavaScript or applet ways to do this out there, but as I'm not a java programmer I'd like to stay with what I know (or am getting to know)... in this case PHP. Unless it's only possible with java, then I guess I'll have to learn that. Thanks in advance! -- Shawn Wilson |
|
|||
|
|
|
|||
|
On Mon, 19 Sep 2005 07:45:43 GMT, "Shawn Wilson"
<firstinitial_lastname@dvigroup.net> wrote: >I'll admit that I haven't looked too hard just yet on this one, but wondered >if the group might have a quick answer. > >Is it possible to use PHP to upload multiple files from a client? And what >I'm thinking is for the client to choose one local folder and for the script >would upload every file in that folder that matches a file mask (*.jpg >specifically). > >It's for my photo album and at present I FTP the files to an import folder >and run my scripts from there that resize and insert into my SQL database. >If I can make it one step though, that would be great. > >I've seen many JavaScript or applet ways to do this out there, but as I'm >not a java programmer I'd like to stay with what I know (or am getting to >know)... in this case PHP. Unless it's only possible with java, then I >guess I'll have to learn that. > >Thanks in advance! Short answer: Yes, it is possible. Longer answer: Review the page in manual. http://www.php.net/manual/en/features.file-upload.php Just create as many input fields as you need as specified in the section "Example 38-3. Uploading array of files". |
|
|||
|
"Tyrone Slothrop" <ts@paranoids.com> wrote in message
news:i5gti15hgijegf3pmrnb8vgo13fsu62els@4ax.com... > On Mon, 19 Sep 2005 07:45:43 GMT, "Shawn Wilson" > <firstinitial_lastname@dvigroup.net> wrote: > >>I'll admit that I haven't looked too hard just yet on this one, but >>wondered >>if the group might have a quick answer. >> >>Is it possible to use PHP to upload multiple files from a client? And >>what >>I'm thinking is for the client to choose one local folder and for the >>script >>would upload every file in that folder that matches a file mask (*.jpg >>specifically). >> >>It's for my photo album and at present I FTP the files to an import folder >>and run my scripts from there that resize and insert into my SQL database. >>If I can make it one step though, that would be great. >> >>I've seen many JavaScript or applet ways to do this out there, but as I'm >>not a java programmer I'd like to stay with what I know (or am getting to >>know)... in this case PHP. Unless it's only possible with java, then I >>guess I'll have to learn that. >> >>Thanks in advance! > > Short answer: Yes, it is possible. > > Longer answer: Review the page in manual. > http://www.php.net/manual/en/features.file-upload.php > Just create as many input fields as you need as specified in the > section "Example 38-3. Uploading array of files". Yeah, if that's where we're left with PHP is doing an individual file box for each file, then you tell me if YOU would do that for 300 files? *smile* I guess maybe I'm stuck looking for a java solution unless I can maybe 'guess' at file names since they are sequential and pre-fill form fields maybe... Here's an idea... given that all the files I want to upload will be in one local directory and all of them will be sequentially named [003000000.jpg through 003000300.jpg] for example... I could make a first screen asking how many files there are and for the first file name. Then submit that to the next page that would make the input boxes and pre-fill their value="" with file names based on my input. Then I could just submit and watch them go. How dirty is that though?? Is there a more elegant way to acomplish that without having the user browse for 300 files manually? -- Shawn Wilson |
|
|||
|
"Shawn Wilson" <firstinitial_lastname@dvigroup.net> wrote:
> I'll admit that I haven't looked too hard just yet on this one, but > wondered if the group might have a quick answer. > > Is it possible to use PHP to upload multiple files from a client? And > what I'm thinking is for the client to choose one local folder and for the > script would upload every file in that folder that matches a file mask > (*.jpg specifically). > > It's for my photo album and at present I FTP the files to an import folder > and run my scripts from there that resize and insert into my SQL database. > If I can make it one step though, that would be great. > > I've seen many JavaScript or applet ways to do this out there, but as I'm > not a java programmer I'd like to stay with what I know (or am getting to > know)... in this case PHP. Unless it's only possible with java, then I > guess I'll have to learn that. Or you may considering using a ready-made applet like: http://jupload.sourceforge.net/ -- bonfils http://kim.bonfils.com "I think if you know what you believe, it makes it a lot easier to answer questions. I can't answer your question." - George W. Bush |
|
|||
|
"Shawn Wilson" <shawnw_nospam_@_nospam_dvigroup.net> wrote in message
news:VWzXe.107524$vo5.21482@fe01.news.easynews.com ... > "Tyrone Slothrop" <ts@paranoids.com> wrote in message > news:i5gti15hgijegf3pmrnb8vgo13fsu62els@4ax.com... >> On Mon, 19 Sep 2005 07:45:43 GMT, "Shawn Wilson" >> <firstinitial_lastname@dvigroup.net> wrote: >> >>>Is it possible to use PHP to upload multiple files from a client? >> >> Short answer: Yes, it is possible. >> >> Longer answer: Review the page in manual. >> http://www.php.net/manual/en/features.file-upload.php >> Just create as many input fields as you need as specified in the >> section "Example 38-3. Uploading array of files". > > Yeah, if that's where we're left with PHP is doing an individual file box > for each file, then you tell me if YOU would do that for 300 files? > *smile* > > I guess maybe I'm stuck looking for a java solution unless I can maybe > 'guess' at file names since they are sequential and pre-fill form fields > maybe... > > Here's an idea... given that all the files I want to upload will be in one > local directory and all of them will be sequentially named [003000000.jpg > through 003000300.jpg] for example... I could make a first screen asking > how many files there are and for the first file name. Then submit that to > the next page that would make the input boxes and pre-fill their value="" > with file names based on my input. Then I could just submit and watch > them go. There's just this annoying thing called security. File fields do not have initial values. File fields cannot be accessed via javascript. Every single file must be selected manually. And there's a reason. Computers also store files that contain confidential information, such as passwords. Now suppose I make a website that has a file field pointing to a confidential file that you don't want anyone to have. We also assume that I know exactly where the file is located on your computer because it's a standard windows file, that's how I know which file to set as initial value. I make the page autosubmit and before you know it, I have stolen your precious data. And now your screwed. That is, if initial values were allowed in file fields. That's why browsers do not accept initial values for file fields. http://www.w3.org/TR/html401/appendi....html#h-B.10.1 "B.10.1 Security issues for forms A user agent should not send any file that the user has not explicitly asked to be sent. Thus, HTML user agents are expected to confirm any default file names that might be suggested by the value attribute of the INPUT element. Hidden controls must not specify files." -- Welcome to Usenet! Please leave tolerance, understanding and intelligence at the door. They aren't welcome here. antaatulla.sikanautaa@gmail.com.NOSPAM.invalid |