|
|
 |
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5  | This is the forum to discuss the Wrox book Beginning PHP4 by Wankyu Choi, Allan Kent, Chris Lea, Ganesh Prasad, Chris Ullman; ISBN: 9780764543647 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other programmers’ questions, win occasional prizes given to our best members, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
|
 |
|
|
 |
|

June 16th, 2003, 11:35 AM
|
|
Registered User
|
|
Join Date: Jun 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
File Uploading Script Problems
Running Win98, with Apache server 1.3.27 & PHP 4.3.0
Having downloaded the file uploading script (page 369) on hitting the upload button I receive a
< You don't have permission to access /TestSite/< on this server. >
message.
What do I need to do to sort this?
Thanx
|

June 16th, 2003, 09:37 PM
|
|
Registered User
|
|
Join Date: Jun 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Have you looked at your permissions on your folder. If you can check them the make sure they are 777 or where you can at least write, read, and execute.
|

December 9th, 2003, 01:20 PM
|
|
Registered User
|
|
Join Date: Dec 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I am having a similar problem. Having downlaoded and written the script on p369 separately I still can't get it to work. Running on SuSE with apache. Upon clicking the upload button after selecting a file nothing happens.
|

December 9th, 2003, 01:25 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: San Diego, CA, USA.
Posts: 833
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Again, have you checked that the temp directory used by PHP for uploaded files exists and that PHP has permission to read and write in that directory?
Take care,
Nik
http://www.bigaction.org/
|

December 10th, 2003, 06:29 AM
|
|
Registered User
|
|
Join Date: Dec 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yeah, I am trying to write to the /tmp directory so php should have permission to write.
|

December 10th, 2003, 12:02 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: San Diego, CA, USA.
Posts: 833
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Okay, so now's the time to be more specific about your problem. What errors, if any, are you seeing? What are the active configuration settings? How big a file are you trying to upload?
If you're not seeing any errors, check the following PHP config values:
error_reporting (should be E_ALL)
display_errors (should be on)
display_startup_errors (should be on)
max_execution_time (should be large enough to support the largest
file uploads from a reasonable connection)
Also, check that file_uploads is "on". If you want to use the system default tmp dir, make sure that upload_tmp_dir is undefined (i.e. commented out).
Take care,
Nik
http://www.bigaction.org/
|

December 10th, 2003, 12:31 PM
|
|
Registered User
|
|
Join Date: Dec 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
What errors, if any, are you seeing? None
Filesize- tried a few files - usually quite small- couple of Megs
What are the active configuration settings? Not sure what you mean- is this the /etc/php.ini
The error reporting setting were already on the variables you suggested and I still don't see any errors???
file_uploads and max_execution_time are on the variables you suggested as well.
|

December 10th, 2003, 12:53 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: San Diego, CA, USA.
Posts: 833
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Wait a minute -- you said in your first post you're having similar problems as the original poster. He was seeing a permission error. Now you're saying that you don't see ANY errors...?!?
I don't quite follow you.
Please do me a favor and start over -- tell me what you're trying to do. Feel free to post some relevant code snippets. Notice I said "snippets", because posting more than 20-30 lines of code doesn't really make our (the people who are trying to help you) lives easier.
Keep in mind that most people won't want to take more time answering your question than you take to ask it.
Now to respond to your last post:
I'd try uploading a much smaller file to begin with -- say, a very small text file. Nothing larger than 1k.
Your configuration settings are defined in php.ini. If running PHP as an apache module, these settings can be changed in httpd.conf and/or .htaccess files. To check the active settings, run a phpinfo script:
<?php phpinfo(); ?>
This function generates a very long page that states all of PHP's active configuration settings, global variables (including get, post, et. al.), and all the enabled extensions (e.g. GD and XSLT).
Take care,
Nik
http://www.bigaction.org/
|

December 10th, 2003, 02:37 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,698
Thanks: 0
Thanked 1 Time in 1 Post
|
|
In my experience with working with uploading files the size of the file doesn't affect max_execution_time, uploading the file via HTTP the file is sent to the server before PHP execution begins, it isn't till all post data is sent that the script being called on begins execution. I've uploaded files up to a MB over a dial-up connection and never received an error of exceeding the max_execution_time.
However there is another configuration direcive that you should check and that's upload_max_filesize. If you're uploading a file larger than that allowed by this directive then I don't think that you'll see any errors, the script would as you have said simply fail (where the uploaded file is conserned) and not display any errors, if I remember correctly. The default is 2MB. Check the value of this directive you should see it in phpinfo() output, or you can display it by calling ini_get("upload_max_filesize").
Again, as Nik has said, it would be helpful for us to see the code you are using to upload the file.
: )
Rich
:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
|

December 11th, 2003, 07:54 AM
|
|
Registered User
|
|
Join Date: Dec 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'm going to try to write the code from scratch as the code in the book doesn't seem to be working for me. So I'll get back to you when I encounter a problem there.
The problem with the code in the book seems to be that the post form doesn't seem to set the upload file variable. There in this bit of the code
<?php
if($action == 'upload') upload_file();
else upload_form();
?>
nothing is done and the upload_form function is recalled, because the $action variable isn't being set.
The post form code is
<FORM METHOD="POST" ENCTYPE="MULTIPART/FORM-DATA"
ACTION="<? echo $PHP_SELF ?>">
<INPUT TYPE="HIDDEN" NAME="action" VALUE="upload">
Upload file!
<INPUT TYPE="FILE" NAME="userfile">
<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="upload">
</FORM>
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |