Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 software programmers and website developers 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 developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 16th, 2003, 10:35 AM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
  #2 (permalink)  
Old June 16th, 2003, 08:37 PM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
Reply With Quote
  #3 (permalink)  
Old December 9th, 2003, 12:20 PM
Registered User
 
Join Date: Dec 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

Reply With Quote
  #4 (permalink)  
Old December 9th, 2003, 12:25 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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/
Reply With Quote
  #5 (permalink)  
Old December 10th, 2003, 05:29 AM
Registered User
 
Join Date: Dec 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah, I am trying to write to the /tmp directory so php should have permission to write.

Reply With Quote
  #6 (permalink)  
Old December 10th, 2003, 11:02 AM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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/
Reply With Quote
  #7 (permalink)  
Old December 10th, 2003, 11:31 AM
Registered User
 
Join Date: Dec 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

Reply With Quote
  #8 (permalink)  
Old December 10th, 2003, 11:53 AM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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/
Reply With Quote
  #9 (permalink)  
Old December 10th, 2003, 01:37 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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
:::::::::::::::::::::::::::::::::
Reply With Quote
  #10 (permalink)  
Old December 11th, 2003, 06:54 AM
Registered User
 
Join Date: Dec 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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>


Reply With Quote
Reply


Thread Tools
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 On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with uploading andregustavo_castro Classic ASP Professional 0 November 7th, 2008 09:02 AM
Problems uploading on dreamweaver CS3!!!! omgdesigns.com Dreamweaver (all versions) 2 May 29th, 2008 05:20 AM
asp file upload script having problems with MYSQL paulmcn Classic ASP Databases 0 September 16th, 2005 01:26 PM
asp uploading script zeeshandar Classic ASP Components 3 November 13th, 2004 07:48 PM



All times are GMT -4. The time now is 06:51 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.