Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0
This is the forum to discuss the Wrox book Beginning PHP5, Apache, and MySQL Web Development by Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass; ISBN: 9780764579660
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 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 Search this Thread Display Modes
  #1 (permalink)  
Old August 24th, 2005, 08:46 PM
Authorized User
 
Join Date: Aug 2005
Location: , , Canada.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 7 file upload problems

I am having trouble with Chapter 7, page 197 of the PHP5 book with getting file upload to work with the code in "upload_image.php" which provides interface to browse for your file to upload:

The code:
---------------------------------------------------------------
<form name="form1" method = "post" action="check_image.php"
    enctype="multipart/form-data>
<table ... etc

etc...

<tr>
<td><input name="image_filename" type="file" d="image_filename"></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Submit">
---------------------------------------------------------------------

I run this code and the form appears OK in the Browser. Then enter the data and browse for the file to upload, and then click Submit to run "check_image.php".

All the $_POST data is passed except for the file_name so the code fails with a bunch of error messages.

I have tried for days to get this to work and began to wonder if there were something wrong in my configuration.

I searched for clues in forums and code snippets. I found a set of code at http://px.sklar.com/
"PX: the PHP code exchange" called "Easy PHP Upload 2.24 by Olaf" which uses class functions.

The download for this is at http://px.sklar.com/section.html?id=14.

This uses "enctype="multipart/form-data" file browser and all the $_POST variables are passed so the code works (after I modified it to fit my directories). So I must be configured properly.

I am using PHP 5.04, Apache 2.0.54 for Windows XP. Also MySQL.

Any ideas why this won't work would be appreciated.
Reply With Quote
  #2 (permalink)  
Old August 27th, 2005, 02:29 PM
Authorized User
 
Join Date: Aug 2005
Location: , , Canada.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oops! I found the answer to my problem. I did not copy a line of code properly from the book.

I typed:
$image_tempname = $_POST['image_filename'];

and it should have been :
$image_tempname = $_FILES['image_filename'];

Dumb mistake!
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 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
Filter File Types in ASP.NET File Upload ramuis78 ASP.NET 2.0 Basics 2 May 31st, 2007 10:50 AM
Problems regarding upload functionality jacob Javascript 1 January 2nd, 2007 06:38 AM
asp file upload script having problems with MYSQL paulmcn Classic ASP Databases 0 September 16th, 2005 01:26 PM
Whole Folder upload(Multi file Upload) ramasamy_rams XML 1 September 9th, 2005 12:43 PM
File upload problems in PHP 4.3.2 clem_c_rock Pro PHP 2 November 1st, 2004 10:49 AM



All times are GMT -4. The time now is 10:05 AM.


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