Page 1 of 1

Basic file upload doubt

Posted: Tue Oct 14, 2008 2:34 pm
by dude81
Can't a I put a file upload in a normal POST form? I tried this I always get $_POST['file-form-variablename1'] but not anything in $_FILES

Re: Basic file upload doubt

Posted: Tue Oct 14, 2008 2:39 pm
by VladSun

Code: Select all

<form enctype="multipart/form-data" .....

Re: Basic file upload doubt

Posted: Tue Oct 14, 2008 2:45 pm
by dude81
The forms we use in our project would be typically look like the following

Code: Select all

 
<form  enctype="multipart/form-data"  action='index.php?x=manager&y=event'  name='event'  method="post" onSubmit="return checkForm();">
<input type="text" name="first_field_value" value=''>
<input type="text" name="second_field_value" value=''>
<input type="file" name="uploadedfile">
<input type="submit" name="submitButton" value="Submit">
 
x and y are parsed and then sent to a right action file

Re: Basic file upload doubt

Posted: Tue Oct 14, 2008 2:47 pm
by VladSun
Check you php.ini for file upload permitions.

Re: Basic file upload doubt

Posted: Tue Oct 14, 2008 2:49 pm
by dude81
I doubted that, but What should I check there?

Code: Select all

 
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
 
; Whether to allow HTTP file uploads.
file_uploads = On
 
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
upload_tmp_dir = "\xampp\tmp"
 
; Maximum allowed size for uploaded files.
upload_max_filesize = 32M
 
 
;;;;;;;;;;;;;;;;;;
; Fopen wrappers ;
;;;;;;;;;;;;;;;;;;
 
; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
allow_url_fopen = On
 
; Whether to allow include/require to open URLs (like http:// or ftp://) as files.
allow_url_include = Off
 
; Define the anonymous ftp password (your email address)
;from="john@doe.com"
 
; Define the User-Agent string
; user_agent="PHP"
 
; Default timeout for socket based streams (seconds)
default_socket_timeout = 60
 
; If your scripts have to deal with files from Macintosh systems,
; or you are running on a Mac and need to deal with files from
; unix or win32 systems, setting this flag will cause PHP to
; automatically detect the EOL character in those files so that
; fgets() and file() will work regardless of the source of the file.
; auto_detect_line_endings = Off
 

Re: Basic file upload doubt

Posted: Tue Oct 14, 2008 3:21 pm
by VladSun
Would you mind posting the output of var_dump($_FILES) ?

Re: Basic file upload doubt

Posted: Tue Oct 14, 2008 4:04 pm
by dude81
its an empty array