[FX.php List] Upload script in PHP?

Bob Patin bob at patin.com
Tue Mar 14 09:00:26 MST 2006


Tom,

That helps a LOT; thanks so much for that really useful tip.

Bob Patin
Longterm Solutions
bob at longtermsolutions.com
615-333-6858
http://www.longtermsolutions.com

   CONTACT US VIA SKYPE:
      USERNAME: longtermsolutions

   CONTACT US VIA INSTANT MESSAGING:
      AIM or iChat: longterm1954
      Yahoo: longterm_solutions
      MSN: bob at patin.com
      ICQ: 159333060


On Mar 13, 2006, at 4:13 PM, Tom Sepper wrote:

> Bob,
>
> You can do it two ways (that I know of) on OS X Server.
>
> 1) Standard Unix CHMOD in a terminal window:  chmod 777 /path/to/dir
>
> 2) Use the Workgroup Manager - the Sharing panel. Navigate to the
> appropriate directory, then go to the Access tab on the right.
>
> Hope this helps.
>
> ---
> Tom Sepper
> Systems Admin
> tsepper at dctandt.com
> 806.762.6354  [v]
> 806.763.7637  [f]
>
> Director's Choice Tour & Travel
> 10701 Upland Avenue
> Lubbock, TX  79424
>
> -----Original Message-----
> From: fx.php_list-bounces at mail.iviking.org
> [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Bob Patin
> Sent: Monday, March 13, 2006 4:04 PM
> To: FX.php Discussion List
> Subject: Re: [FX.php List] Upload script in PHP?
>
> Well, now that I've looked at the folder's permissions, I see that I
> can't change them... I've had so many gotchas with permissions on my
> servers. I've been moving sites from an older web server running
> WebStar to the newer servers running OS X Server, and many times I've
> not been able to access a site because of permissions problems.
>
> So my questions are these:
>
> 1) How do I set permissions for this uploads folder?
> 2) In the future, how does one set permissions for a folder
> containing a web site? I tried resetting permissions for the site's
> folder, but that never works. I usually end up downloading the entire
> site from the server, changing permissions on my computer here,
> nuking all the existing pages, and then re-uploading. That series of
> convoluted steps usually fixes it.
>
> Anyway, I appreciate the list's patience and help with this.
>
> Bob
>
>
>
> On Mar 13, 2006, at 3:56 PM, Bob Patin wrote:
>
>> Dale,
>>
>> Do you recall what you set permissions to for the uploads folder?
>> Should I set it to my own username?
>>
>> Slowly slogging through this, hopefully making headway,
>>
>> Bob
>>
>>
>> On Mar 13, 2006, at 11:11 AM, Dale Bengston wrote:
>>
>>> Hi Bob,
>>>
>>> I took mine right from the php.net's examples about uploading files:
>>>
>>> <http://us2.php.net/manual/en/features.file-upload.php>
>>>
>>> Here is their upload HTML form:
>>>
>>> <!-- The data encoding type, enctype, MUST be specified as below -->
>>> <form enctype="multipart/form-data" action="__URL__" method="POST">
>>>     <!-- MAX_FILE_SIZE must precede the file input field -->
>>>     <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
>>>     <!-- Name of input element determines name in $_FILES array -->
>>>     Send this file: <input name="userfile" type="file" />
>>>     <input type="submit" value="Send File" />
>>> </form>
>>>
>>> The three comment lines identify the big differences in this form
>>> and more traditional html forms. Note that the MAX_FILE_SIZE value
>>> is largely ignored by the browser, so you'll need to evaluate that
>>> after the file is uploaded (file size is part of the $_FILES
>>> array... see immediately below).
>>>
>>> Once uploaded, PHP stores info about the file in the $_FILES
>>> array. You can find the details of the elements of $_FILES on the
>>> page linked above, but the elements for the uploaded 'userfile'
>>> above are:
>>>
>>> $_FILES['userfile']['name'] The original name of the uploaded file
>>> on the client machine.
>>>
>>> $_FILES['userfile']['type'] The mime type of the file, if the
>>> browser provided this information. An example would be "image/
>>> gif". This mime type is however not checked on the PHP side and
>>> therefore don't take its value for granted.
>>>
>>> $_FILES['userfile']['size'] The size, in bytes, of the uploaded  
>>> file.
>>>
>>> $_FILES['userfile']['tmp_name'] The temporary filename of the file
>>> in which the uploaded file was stored on the server.
>>>
>>> $_FILES['userfile']['error'] The error code associated with this
>>> file upload. This element was added in PHP 4.2.0
>>>
>>> The uploaded file lands in a temp directory, and you use php's
>>> move_uploaded_file() to relocate it to your appropriate web
>>> directory. You can also rename it and use the values in $_FILES
>>> check for different file types and file sizes (although the mime
>>> type thing isn't bulletproof).
>>>
>>> Things to watch out for: file and folder permissions on the final
>>> resting place for your uploads, since the www user has pretty
>>> limited access. Also, your php.ini file probably has a
>>> upload_max_filesize set to 2MB. If the PDFs being uploade are
>>> larger than 2MB, you'll need to up this value. If you're changing
>>> upload_max_filesize, you'll need to look at post_max_size too.
>>>
>>> Hope this helps,
>>> Dale
>>>
>>>
>>> On Mar 13, 2006, at 9:59 AM, Bob Patin wrote:
>>>
>>>> Does anyone have any code for writing a simple upload script in
>>>> PHP? I tried some code that I found online, but have been unable
>>>> to get it to work.
>>>>
>>>> I have a client who needs to put a form on their site so that
>>>> clients can upload PDF files directly into their web folder on
>>>> the web server.
>>>>
>>>> Any help would be greatly appreciated.
>>>>
>>>> Thanks,
>>>>
>>>> Bob Patin
>>>> Longterm Solutions
>>>> bob at longtermsolutions.com
>>>> 615-333-6858
>>>> http://www.longtermsolutions.com
>>>>
>>>>   CONTACT US VIA SKYPE:
>>>>      USERNAME: longtermsolutions
>>>>
>>>>   CONTACT US VIA INSTANT MESSAGING:
>>>>      AIM or iChat: longterm1954
>>>>      Yahoo: longterm_solutions
>>>>      MSN: bob at patin.com
>>>>      ICQ: 159333060
>>>>
>>>>
>>>> _______________________________________________
>>>> FX.php_List mailing list
>>>> FX.php_List at mail.iviking.org
>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list