[PHP] Problem uploading files other than text/plain ones

2002-12-02 Thread Wilmar Perez
Hello guys

I'm trying to do a simple task: upload files.  However, when I try to upload files 
other than text/plain ones I get an empty $_FILES array.  Is there anything I've got 
to modify in my php.ini file?  I'm just following the expample in the php manual, the 
only thing different is that I process the upload task with a function:

function upload_file($_POST, $_FILES)
{
  //The same code as in the php manual
  return true;  //If everything went ok
}

if (upload_file($_POST, $_FILES))
   echo The file has been uploaded;
else
   echo Sorry, try again;


It works fine with text/plain files, so, am I overlooking anything here?

Thanks a lot

***
 Wilmar Pérez
 Network Administrator
   Library System
  Tel: ++57(4)2105962
University of Antioquia
   Medellín - Colombia
  2002
***
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Problem uploading files other than text/plain ones

2002-12-02 Thread Keith Sauvant
You know about the php.ini option upload_max_filesize? Perhaps its
default value is not enough for your task?

Greeting from
Keith
Aachen, Germany


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Problem uploading files other than text/plain ones

2002-12-02 Thread Andre Dubuc
Hi Wilmar,

Check whether you have something similar:

form action=auth-x.php method=post enctype=multipart/form-data

You'll definetly need that for antything other than text/plain ones..

Here's a some code that works for me (uploading jpgs):

if ($_FILES[pix][size]  0){
if ($_FILES[pix][type] == image/jpeg){
$pix_file = $_FILES[pix][name];
$pix_temp_file = $_FILES[pix][tmp_name];
$new_pix_file = new_name.jpg;
if(is_uploaded_file($pix_temp_file)){
move_uploaded_file($pix_temp_file, pix/$new_pix_file);
}
}
}

Hth,
Andre

On Monday 02 December 2002 11:41 am, Wilmar Perez wrote:
 Hello guys

 I'm trying to do a simple task: upload files.  However, when I try to
 upload files other than text/plain ones I get an empty $_FILES array.  Is
 there anything I've got to modify in my php.ini file?  I'm just following
 the expample in the php manual, the only thing different is that I process
 the upload task with a function:

 function upload_file($_POST, $_FILES)
 {
   //The same code as in the php manual
   return true;  //If everything went ok
 }

 if (upload_file($_POST, $_FILES))
echo The file has been uploaded;
 else
echo Sorry, try again;


 It works fine with text/plain files, so, am I overlooking anything here?

 Thanks a lot

 ***
  Wilmar Pérez
  Network Administrator
Library System
   Tel: ++57(4)2105962
 University of Antioquia
Medellín - Colombia
   2002
 ***

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Problem uploading files

2002-10-04 Thread Wilmar Perez

Hello guys

This is my first post to the list, hope you can give point me to the right 
direction.

Well, I've been trying to upload a file without much success so far.

All I get is my firs error message: There is no file to send (shown in the 
script).

This is my form:

form enctype=multipart/form-data name=book_add method=post 
action=.$PHP_SELF.?management=5
input type=hidden name=MAX_FILE_SIZE value=2000
table width=100% border=0 bgcolor=#CC
 tr 
  td width=51%Book Name:/td
  td width=49%input type=text name=form_title size=40/td
 /tr
tr 
td width=51%File:/td
td width=49%input type=file name=formfile/td
/tr
tr align=center 
td width=51%input type=reset name=reset value=Clean/td
td width=49%input type=submit name=submit value=Add new book/td
/tr
/table
/form


And this is the script that handles the data:


if ($formfile == none)
{
echo There is no file to send;
exit;
}

if ($formfile_size == 0)
{
echo Bad file size;
exit;
}

if ($formfile_type != application/pdf)
{
echo Non a PDF file;
exit;
}

if (!is_uploaded_file($formfile))
{
echo Warning!!!;
exit;
}

$upfile = /var/www/bva/new/pdf/.$formfile_name;


if (!copy($formfile, $upfile))
{
echo There was a problem moving the file to the repository;
exit;
}
else
{
echo New book has been uploaded;
exit;
}




Thanks a lot for your help.


***
 Wilmar Pérez
 Network Administrator
   Library System
  Tel: ++57(4)2105145
University of Antioquia
   Medellín - Colombia
  2002
***
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Problem uploading files

2002-10-04 Thread Justin French

A few observations:

if ($formfile == none)
{
echo There is no file to send;
exit;
}

for starters, I don't see how $formfile could ever be none... secondly, if
you have register_globals set to off in your php.ini, $formfile wont' even
be a variable, but you've only sent what looks like partial code, so I can't
be sure.


Can I recommend you try to get the perfectly good, working example of file
uploads working that is available on this page:

http://www.php.net/manual/en/printwn/features.file-upload.php


Once you get it working, you can tweak it to suit your needs, rather than
reinventing the wheel over and over... just improve on it.


Justin






on 05/10/02 2:04 AM, Wilmar Perez ([EMAIL PROTECTED]) wrote:

 Hello guys
 
 This is my first post to the list, hope you can give point me to the right
 direction.
 
 Well, I've been trying to upload a file without much success so far.
 
 All I get is my firs error message: There is no file to send (shown in the
 script).
 
 This is my form:
 
 form enctype=multipart/form-data name=book_add method=post
 action=.$PHP_SELF.?management=5
 input type=hidden name=MAX_FILE_SIZE value=2000
 table width=100% border=0 bgcolor=#CC
 tr 
 td width=51%Book Name:/td
 td width=49%input type=text name=form_title size=40/td
 /tr
 tr 
 td width=51%File:/td
 td width=49%input type=file name=formfile/td
 /tr
 tr align=center
 td width=51%input type=reset name=reset value=Clean/td
 td width=49%input type=submit name=submit value=Add new book/td
 /tr
 /table
 /form
 
 
 And this is the script that handles the data:
 
 
 if ($formfile == none)
 {
 echo There is no file to send;
 exit;
 }
 
 if ($formfile_size == 0)
 {
 echo Bad file size;
 exit;
 }
 
 if ($formfile_type != application/pdf)
 {
 echo Non a PDF file;
 exit;
 }
 
 if (!is_uploaded_file($formfile))
 {
 echo Warning!!!;
 exit;
 }
 
 $upfile = /var/www/bva/new/pdf/.$formfile_name;
 
 
 if (!copy($formfile, $upfile))
 {
 echo There was a problem moving the file to the repository;
 exit;
 }
 else
 {
 echo New book has been uploaded;
 exit;
 }
 
 
 
 
 Thanks a lot for your help.
 
 
 ***
 Wilmar Pérez
 Network Administrator
 Library System
 Tel: ++57(4)2105145
 University of Antioquia
 Medellín - Colombia
 2002
 ***
 
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Problem uploading files

2002-10-04 Thread Wilmar Perez

Hello

Justin, thanks for your comments.  Well just to answer your questions:

1.  I've got register_globals set to ON.  I have never had problem before 
with my forms, but this is the first time I try to upload a file.

2.  I'm following the sample code you recommend.  They're in fact pretty 
simmilar .

Thanks a lot again.

***
 Wilmar Pérez
 Network Administrator
   Library System
  Tel: ++57(4)2105145
University of Antioquia
   Medellín - Colombia
  2002
***
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] problem uploading files

2001-09-17 Thread Paul Morin

I have a problem with file uploads in php.  My code seems to run fine if I
am on the local area network but seems to fail when I try from the outside.
My server seems to time out.  I suspect that the problem could be with the
firewall but am unsure.  I have php_safe directive off in the php.ini file
and at one time I was able to upload files but cannot figure out what has
changed.  I am currently using RH 7.1, apache 1.3.20 and php 4.0.6.  Help
anyone



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]