Uploading multiple files...

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


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-19-2005
Shawn Wilson
 
Posts: n/a
Default Uploading multiple files...

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


Reply With Quote
  #2 (permalink)  
Old 09-19-2005
Zilla
 
Posts: n/a
Default Re: Uploading multiple files...

Try looking at this chapter in the php manual:

http://www.php.net/features.file-upload

Zilla
Reply With Quote
  #3 (permalink)  
Old 09-19-2005
Tyrone Slothrop
 
Posts: n/a
Default Re: Uploading multiple files...

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".
Reply With Quote
  #4 (permalink)  
Old 09-19-2005
Shawn Wilson
 
Posts: n/a
Default Re: Uploading multiple 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


Reply With Quote
  #5 (permalink)  
Old 09-20-2005
bonfils
 
Posts: n/a
Default Re: Uploading multiple files...

"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


Reply With Quote
  #6 (permalink)  
Old 09-20-2005
Kimmo Laine
 
Posts: n/a
Default Re: Uploading multiple files...

"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


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:06 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0