Reply to Re: Fopen failure

Your name:

Reply:


Posted by Erwin Moller on 01/24/08 11:09

faraz_mit wrote:
> HI Guys,
> I am making a php file which gathers data from a form and sends an
> email with attachment. Here is a small part of that:
>
> $filename = $_FILES['document_file_name']['name'];
> $path = $_FILES['document_file_name']['tmp_name'];
> $file =$path."/".$filename;
> echo ($file); /* which is /var/tmp/phpB2TeJi/DSC_0082.jpg */

From php.net:

$_FILES['userfile']['tmp_name']

The temporary filename of the file in which the uploaded file was
stored on the server.

You already HAVE the full path to the file.
It is NOT a directory, but a filename.
Do not add the $_FILES['document_file_name']['name'] to it, and you
should be fine.

Regards,
Erwin Moller

>
> $handle = fopen($file, "r");
> if(!($handle = fopen($file, 'r'))) echo "File failed to open";
>
> Now when i run the code i get the following warnings:
>
> Warning: fopen(/var/tmp/phpB2TeJi/DSC_0082.jpg) [function.fopen]:
> failed to open stream: Not a directory in sendmailattach.php on line
> 17
>
> Warning: fopen(/var/tmp/phpB2TeJi/DSC_0082.jpg) [function.fopen]:
> failed to open stream: Not a directory in sendmailattach.php on line
> 18
> File failed to open
>
> Can somebody tell me please what is wrong with the way i call fopen.
> I am running on a shared server and also tried different permissions
> such as r and rb.
>
> Thanks in advance
> Ross

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация