0

Here is an interesting one for you! I am building a Social Network and when a user signs up my system creates a directory to hold images, mp4's and the like.

I have written a script for profile avatar's that works perfectly fine but I have a cover image much like the facebook ones. The script is very similar to the avatar script but for some reason my system hangs on that scripts page and no errors show up.

Here is the part of the logic that should let the user upload a cover image...

include_once("../php_includes/image_resize.php");
        $target_file = "../user/$log_username/$db_file_name";
        $resized_file = "../user/$log_username/$db_file_name";
        $wmax = 912;
        $hmax = 320;
        img_resize($target_file, $resized_file, $wmax, $hmax, $fileExt);
        $sql = "UPDATE users SET herocover='$db_file_name' WHERE username='$log_username' LIMIT 1";
        $query = mysqli_query($db_conx, $sql);
        mysqli_close($db_conx);
        header("location: ../user.php?u=$log_username");
        exit();
        }

As I have said before this is very similar to the avarat script and should work perfectly fine but for some reason nothing happens and no erros show up in my error log.

Thanks in advance.

2 Answers 2

1

Well, try debugging image_resize.php. I'd start looking there if it's not a folder permissions issue. The only difference from the avatar script which works is that you are dealing with larger images? Try using exceptions to figure out the problem. It's hard to figure it out without more information...

Sign up to request clarification or add additional context in comments.

Comments

0

Make sure you CHMOD your folders. If you fail to CHMOD them to allow editing, then no files can be uploaded.

chmod 0755 <upload-dir>

However, if you're still have problems, you could base64 encode the image, and store this in the database, this stops the need for storing them locally on the server.

These settings should help with the file size and upload time.

ini_set('upload_max_filesize', '10M');
ini_set('post_max_size', '10M');
ini_set('max_input_time', 300);
ini_set('max_execution_time', 300);

10 Comments

Cheers James, all permissions are in place buddy. thanks anyway!
So the error here is that is just hangs and nothing more?
Yep thats all that happens!
Curious, is the cover script in a different directory location to the avatar script? Could you possibly upload a sample of the html and php together into pastebin so I can look at the full code?
Okay, I've been thinking and thought it could be due to php settings, edited my answer.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.