Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 07-05-2007, 11:53 PM   #1 (permalink)
metazai
Regular Contributor
 
Join Date: Apr 2004
Location: Orange County, CA
Posts: 124
metazai is on a distinguished road
file upload problem

Howdy.

Anyone see any problems here:

Code:
         <form action"includes/uploaditems.php" method="post" enctype="multipart/form-data"> <span class="verd14boldblue">CALENDAR</span><br />
          <br />
          <strong>UPLOAD LATEST FILE</strong><br />
          <input type="file" name="userfile"/><br />
          <input type="submit" value="Upload File" />
          <br />
          <br /></form>
Or on the uploaditems.php page:

Code:
<?php

$uploaddir = '../../documents/';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];

print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    print "File is valid, and was successfully uploaded. ";
    print "Here's some more debugging info:\n";
    print_r($_FILES);
} else {
    print "Possible file upload attack!  Here's some debugging info:\n";
    print_r($_FILES);
}
print "</pre>";



?>
?????

Because it doesn't do anything but reload the original page -- no error codes, nothing. That last code segment is the entire uploaditems.php page, but it ain't uploading items. It's late, and I'm sure I'm missing something . . . . Any help would be appreciated.
metazai is offline   Reply With Quote
Old 07-06-2007, 09:21 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,490
sde is on a distinguished road
is php configured properly? from the code, it looks like you are referencing php.net, and it does look right.

just verify the Related Configurations Note on this page. if you don't have access to the php.ini, you could probably just look at phpinfo(); output.
__________________
Mike
sde is offline   Reply With Quote
Old 07-06-2007, 09:39 AM   #3 (permalink)
metazai
Regular Contributor
 
Join Date: Apr 2004
Location: Orange County, CA
Posts: 124
metazai is on a distinguished road
I believe it is configured properly, and I am uploading image files on other parts of the site just fine.

It's a .csv file I'm uploading, and it's not the only form on the page. Would that make any difference?
metazai is offline   Reply With Quote
Old 07-06-2007, 10:03 AM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,490
sde is on a distinguished road
it shouldn't matter if it is the only form on the page or not. are you sure the upload directory has the proper permissions set for php to copy files to?
__________________
Mike
sde is offline   Reply With Quote
Old 07-06-2007, 10:12 AM   #5 (permalink)
metazai
Regular Contributor
 
Join Date: Apr 2004
Location: Orange County, CA
Posts: 124
metazai is on a distinguished road
775

Last edited by metazai; 07-06-2007 at 10:13 AM. Reason: Can't type
metazai is offline   Reply With Quote
Old 07-06-2007, 10:25 AM   #6 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,490
sde is on a distinguished road
5 is read/execute .. it probably needs to be 777.
__________________
Mike
sde is offline   Reply With Quote
Old 07-06-2007, 10:56 AM   #7 (permalink)
metazai
Regular Contributor
 
Join Date: Apr 2004
Location: Orange County, CA
Posts: 124
metazai is on a distinguished road
Interesting . . . doesn't work on 777 either, but regardless, should I be getting an error response on that second page? I can't even tell if it's going to it at all.
metazai is offline   Reply With Quote
Old 07-06-2007, 02:16 PM   #8 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,490
sde is on a distinguished road
print your file array on the page it gets submitted to.
PHP Code:
<?php
header
('content-type: text/plain');
print_r($_FILES);
exit;
?>
__________________
Mike
sde is offline   Reply With Quote
Old 07-06-2007, 03:34 PM   #9 (permalink)
metazai
Regular Contributor
 
Join Date: Apr 2004
Location: Orange County, CA
Posts: 124
metazai is on a distinguished road
Well, that makes it official. It's not submitting to that page at all, and I think I figured out why.
Code:
<form action"includes/uploaditems.php" method="post" enctype="multipart/form-data">
For my shameful oversight, there is no equal . . . literally . . . after the word action.

Or, to be more poetic about it,

Son-of-a-(*&^(%(#&&@@@!!?#?!@#@!
metazai is offline   Reply With Quote
Old 07-06-2007, 06:53 PM   #10 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,490
sde is on a distinguished road
lol .. what's worse is a second set of eyes didn't catch it =/
__________________
Mike
sde is offline   Reply With Quote
Reply

Bookmarks

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Output problem with file manipulation (newbie) crazyant Java 4 03-11-2005 01:03 PM


All times are GMT -8. The time now is 06:37 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting