Re: [PHP] upload file problem

2008-07-31 Thread Jignesh Thummar
Thanks.. It's fixed...

- Jignesh

On Thu, Jul 31, 2008 at 6:05 PM, brian <[EMAIL PROTECTED]> wrote:
> Jignesh Thummar wrote:
>>
>> I'm trying to upload the file. It's showing me successfully uploaded.
>> But it's not able to move from temp directory to my defined directory
>>
>> my code:
>>
>> if (is_uploaded_file($_FILES['myfile']['tmp_name'])) {
>>   move_uploaded_file($_FILES['myfile']['tmp_name'], $myfilename);
>>   echo "File ". $_FILES['myfile']['name'] ." uploaded successfully.\n";
>> } else {
>>  echo "File uploading error";
>> }
>>
>
> What does $myfilename resolve to? It should include the complete path from
> server root (not DOCUMENT_ROOT).
>
> Try:
>
> echo "File uploading error: ${myfilename}";
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] upload file problem

2008-07-31 Thread brian

Jignesh Thummar wrote:

I'm trying to upload the file. It's showing me successfully uploaded.
But it's not able to move from temp directory to my defined directory

my code:

if (is_uploaded_file($_FILES['myfile']['tmp_name'])) {
   move_uploaded_file($_FILES['myfile']['tmp_name'], $myfilename);
   echo "File ". $_FILES['myfile']['name'] ." uploaded successfully.\n";
} else {
 echo "File uploading error";
}



What does $myfilename resolve to? It should include the complete path 
from server root (not DOCUMENT_ROOT).


Try:

echo "File uploading error: ${myfilename}";

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



Re: [PHP] upload file problem

2008-07-31 Thread Daniel Brown
On Thu, Jul 31, 2008 at 10:18 AM, Jignesh Thummar
<[EMAIL PROTECTED]> wrote:
> I'm trying to upload the file. It's showing me successfully uploaded.
> But it's not able to move from temp directory to my defined directory
>
> my code:
>
> if (is_uploaded_file($_FILES['myfile']['tmp_name'])) {
>   move_uploaded_file($_FILES['myfile']['tmp_name'], $myfilename);
>   echo "File ". $_FILES['myfile']['name'] ." uploaded successfully.\n";
> } else {
>  echo "File uploading error";
> }

If it is passing the if(is_uploaded_file()) condition, echo out
$myfilename and make sure it's valid to use as a path/filename.

-- 

Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] upload file problem

2008-07-31 Thread Micah Gersten
Maybe check the return value of the function:
http://us3.php.net/manual/en/function.move-uploaded-file.php

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Jignesh Thummar wrote:
> I'm trying to upload the file. It's showing me successfully uploaded.
> But it's not able to move from temp directory to my defined directory
>
> my code:
>
> if (is_uploaded_file($_FILES['myfile']['tmp_name'])) {
>move_uploaded_file($_FILES['myfile']['tmp_name'], $myfilename);
>echo "File ". $_FILES['myfile']['name'] ." uploaded successfully.\n";
> } else {
>  echo "File uploading error";
> }
>
> Thanks in advance.
>
> -Jignesh
>
>   

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



Re: [PHP] upload file problem

2008-07-31 Thread Jignesh Thummar
it's writable.

On Thu, Jul 31, 2008 at 3:37 PM, Eric Butera <[EMAIL PROTECTED]> wrote:
> On Thu, Jul 31, 2008 at 10:18 AM, Jignesh Thummar
> <[EMAIL PROTECTED]> wrote:
>> I'm trying to upload the file. It's showing me successfully uploaded.
>> But it's not able to move from temp directory to my defined directory
>>
>> my code:
>>
>> if (is_uploaded_file($_FILES['myfile']['tmp_name'])) {
>>   move_uploaded_file($_FILES['myfile']['tmp_name'], $myfilename);
>>   echo "File ". $_FILES['myfile']['name'] ." uploaded successfully.\n";
>> } else {
>>  echo "File uploading error";
>> }
>>
>> Thanks in advance.
>>
>> -Jignesh
>
> Is the directory you're moving to writable by your web server?  If you
> don't know, try making a separate script that tries
> var_dump(is_writable('/path/to/uploads'));
>

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



Re: [PHP] upload file problem

2008-07-31 Thread Eric Butera
On Thu, Jul 31, 2008 at 10:18 AM, Jignesh Thummar
<[EMAIL PROTECTED]> wrote:
> I'm trying to upload the file. It's showing me successfully uploaded.
> But it's not able to move from temp directory to my defined directory
>
> my code:
>
> if (is_uploaded_file($_FILES['myfile']['tmp_name'])) {
>   move_uploaded_file($_FILES['myfile']['tmp_name'], $myfilename);
>   echo "File ". $_FILES['myfile']['name'] ." uploaded successfully.\n";
> } else {
>  echo "File uploading error";
> }
>
> Thanks in advance.
>
> -Jignesh

Is the directory you're moving to writable by your web server?  If you
don't know, try making a separate script that tries
var_dump(is_writable('/path/to/uploads'));

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



[PHP] upload file problem

2008-07-31 Thread Jignesh Thummar
I'm trying to upload the file. It's showing me successfully uploaded.
But it's not able to move from temp directory to my defined directory

my code:

if (is_uploaded_file($_FILES['myfile']['tmp_name'])) {
   move_uploaded_file($_FILES['myfile']['tmp_name'], $myfilename);
   echo "File ". $_FILES['myfile']['name'] ." uploaded successfully.\n";
} else {
 echo "File uploading error";
}

Thanks in advance.

-Jignesh

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



Re: [PHP] upload file problem

2005-07-10 Thread Richard Lynch
On Sat, July 9, 2005 1:39 am, Ahmed Abdel-Aliem said:
> Hi
> i have a problem with a code to upload files on server
> here is the code
>
> $f =& $HTTP_POST_FILES['News_Pic'];

Use $_FILES to stay current...

> $dst_file_name = generateUniqueId();
>
> $arr = split("\.",$f['name']);
>
> $f['name'] = $dst_file_name;
>
> $f['name'] .= ".".$arr[count($arr)-1];
>
> $dest_dir = 'main/pictures';
>
> $dest = $dest_dir . '/' .$f['name'];

So, what happened to $dst_file_name?

Far as I can tell, you've never used it...

> $r = move_uploaded_file($f['tmp_name'], $dest);

> $News_Pic = $f['name'];
> chmod($dest, 777);

Nooo!

You should *NOT* be trying to make the files 777.

And it should be 0777 anyway.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] upload file problem

2005-07-09 Thread Ahmed Abdel-Aliem
Hi
i have a problem with a code to upload files on server
here is the code 

$f =& $HTTP_POST_FILES['News_Pic'];

$dst_file_name = generateUniqueId();

$arr = split("\.",$f['name']);

$f['name'] = $dst_file_name;

$f['name'] .= ".".$arr[count($arr)-1];

$dest_dir = 'main/pictures';

$dest = $dest_dir . '/' .$f['name'];

$r = move_uploaded_file($f['tmp_name'], $dest);

$News_Pic = $f['name'];
chmod($dest, 777);

after uploading a file i check the folder and i find nothing uploaded
and when i check the MySQL Table for the filed of the name of the
picture i find this
ef26fc32a2855a4edb6ef389b8b621af.
it should be that random number followed by the extension, for example :
ef26fc32a2855a4edb6ef389b8b621af.jpg
but this deosn't happen and the file is not uploaded
can anyone help me with this plz ?
-- 
Ahmed Abdel-Aliem
Web Developer
www.ApexScript.com
0101108551
registered Linux user number 382789

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



RE: [PHP] Upload File Problem

2002-07-18 Thread Mark Colvin

Joakim,

Thanks again. $HTTP_POST did the trick. I did look through the archives
before posting but didn't come across this solution. I obviously didn't look
hard enough!




This e-mail is intended for the recipient only and
may contain confidential information. If you are
not the intended recipient then you should reply
to the sender and take no further ation based
upon the content of the message.
Internet e-mails are not necessarily secure and
CCM Limited does not accept any responsibility
for changes made to this message. 
Although checks have been made to ensure this
message and any attchments are free from viruses
the recipient should ensure that this is the case.


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




RE: [PHP] Upload File Problem

2002-07-18 Thread joakim . andersson

> From: Mark Colvin [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 18, 2002 12:41 PM
> To: [EMAIL PROTECTED]
> 
> Joakim,
> 
> Thank you for your reply. I tried your example and get 
> 'Possible file upload
> attack: filename.' meaning that 'if
> (is_uploaded_file($_FILES['img1']['tmp_name']))' returns 
> false. I put a
> couple of echo statements in before the if statement to check 
> '$img1_name'
> '$img1_size and '$img1_type' and these all returned the 
> correct values. I
> have my upload_tmp_dir in php.ini set to /var/www/html/img 
> and this folder
> has 777 permissions. Do you think the file is not getting to 
> temp directory
> and if so any idea why?

Have you tried echoing $_FILES['img1']['tmp_name'] or
$HTTP_POST_FILES['img1']['tmp_name']?
If the first doesn't work, you may have to exchange $_FILES to
$HTTP_POST_FILES or $_FILES['img1']['tmp_name'] to $img1_tmp_name etc.

/Joakim

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




RE: [PHP] Upload File Problem

2002-07-18 Thread Mark Colvin

Joakim,

Thank you for your reply. I tried your example and get 'Possible file upload
attack: filename.' meaning that 'if
(is_uploaded_file($_FILES['img1']['tmp_name']))' returns false. I put a
couple of echo statements in before the if statement to check '$img1_name'
'$img1_size and '$img1_type' and these all returned the correct values. I
have my upload_tmp_dir in php.ini set to /var/www/html/img and this folder
has 777 permissions. Do you think the file is not getting to temp directory
and if so any idea why?




This e-mail is intended for the recipient only and
may contain confidential information. If you are
not the intended recipient then you should reply
to the sender and take no further ation based
upon the content of the message.
Internet e-mails are not necessarily secure and
CCM Limited does not accept any responsibility
for changes made to this message. 
Although checks have been made to ensure this
message and any attchments are free from viruses
the recipient should ensure that this is the case.


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




RE: [PHP] Upload File Problem

2002-07-18 Thread joakim . andersson

> From: Mark Colvin [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 18, 2002 10:09 AM
>
>   -- upload.php --
>  
> if ('img1' != "") {
This will allways be true! 'img1' is a string and will never be empty.
You probably mean if($img1 != "")
However, I'm not sure this will work in this case.

Try this instead. (Taken straight from the PHP-manual. A real good
resource!)



If you use PHP < 4.1.0 you must exchange $_FILES to $HTTP_POST_FILES

Regards
Joakim Andersson

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




[PHP] Upload File Problem

2002-07-18 Thread Mark Colvin

I have a simple script that attempts to upload a file and save it on the
server. When I click send file I get this error message 'Warning: Unable to
open '' for reading: No such file or directory in /var/www/html/upload.php
on line 5
Couldn't copy the file!'. The file is being uploaded from a Win 2000 machine
and the php script live on an apache web server on a linux box. I have chmod
777 the 'image' directory. Any ideas?
Here's the code -

-- upload.html --


Upload a File




Upload a File



File to Upload:









-- upload.php --





This e-mail is intended for the recipient only and
may contain confidential information. If you are
not the intended recipient then you should reply
to the sender and take no further ation based
upon the content of the message.
Internet e-mails are not necessarily secure and
CCM Limited does not accept any responsibility
for changes made to this message. 
Although checks have been made to ensure this
message and any attchments are free from viruses
the recipient should ensure that this is the case.


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