Author Topic: An error with PHP  (Read 661 times)

I don't know PHP so I'm going to ask you guys to help me figure this stuff out. :(

The error is:
Code: [Select]
Warning: move_uploaded_file(/home/a6353100/public_html/src/1333247592447.tmp) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/a6353100/public_html/imgboard.php on line 352

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpqKMU7u' to '/home/a6353100/public_html/src/1333247592447.tmp' in /home/a6353100/public_html/imgboard.php on line 352
Line 352 is:
Code: [Select]
move_uploaded_file($upfile, $dest);and the entire code that handles uploading files (This is for an imageboard) is:
Code: [Select]
if($upfile&&file_exists($upfile)){
    $dest = $path.$tim.'.tmp';
    move_uploaded_file($upfile, $dest);
    //if an error in up, it changes to down (what?)
    //copy($upfile, $dest);
    $upfile_name = CleanStr($upfile_name);
    if(!is_file($dest)) error(S_UPFAIL,$dest);
    $size = getimagesize($dest);
    if(!is_array($size)) error(S_NOREC,$dest);
    $md5 = md5_of_file($dest);
    foreach($badfile as $value){if(ereg("^$value",$md5)){
      error(S_SAMEPIC,$dest); //Refuse this image
    }}
    chmod($dest,0666);
    $W = $size[0];
    $H = $size[1];
    $fsize = filesize($dest);
    if($fsize>MAX_KB * 1024) error(S_TOOBIG,$dest);
    switch ($size[2]) {
      case 1 : $ext=".gif";break;
      case 2 : $ext=".jpg";break;
      case 3 : $ext=".png";break;
      case 4 : $ext=".swf";break;
      case 5 : $ext=".psd";break;
      case 6 : $ext=".bmp";break;
      case 13 : $ext=".swf";break;
      default : $ext=".xxx";break;
    }
It seems to be complaining about not being able transfer to a directory that's not there but I don't see where it's trying to go to.

Is /home/a6353100/public_html/src/ a directory?

Is /home/a6353100/public_html/src/ a directory?
Yes it is, it's also set to 777 (Chmod)

Im gonna say go learn Python. It's a much better language. As for your problem, I got no clue.

Im gonna say go learn Python. It's a much better language.
Leave.

In the if statement, $upfile is checked as if it were a path because you're using file_exists. move_uploaded_file needs to be a string of the file, and I don't know what you're trying to do.

Leave.

In the if statement, $upfile is checked as if it were a path because you're using file_exists. move_uploaded_file needs to be a string of the file, and I don't know what you're trying to do.
http://blockponies.hostei.com/imgboard.htm
Here is the website if you attempt to load an image up the errors show up.

bump

Edit:

I bump it and I figured out how to fix it. :/

Alright what I did to fix it was I made two new directories in  (src and thumb) in the same directory as imgboard.php and config.php and all of those it then just started working!
« Last Edit: April 01, 2012, 11:17:51 AM by zookuw »