Jump to content

Recommended Posts

Hi guys, one of my clients has been having problems for a long time with image uploading - I've tried several methods to try and get it working, and thought "hurrah! Finally!" when they reported success using Uploadify. You can imagine my disappointment when I got an email saying 'oh, I tried it from the laptop at home and it wouldn't work'.

 

The code process goes like this:

 

Image comes in through $_FILE

Gets a new name set

move_uploaded_file does its stuff

image is resized to sane dimensions

A record is put in a database

 

I've learned now that what happens when it fails is that the code steps through to move_uploaded_file and then fails on the resize method. There's nothing actually wrong with the resize method - I have never been able to replicate the behaviour my client is reporting on any machine, it always works for me. Moreover, the behaviour only apparently occurs on certain machines.

 

What on earth could be causing this? Script timeouts if they upload gigantic files? But why would it only happen on certain boxes? The time of day doesn't seem to matter either.

 

I'd really appreciate any ideas you guys might have about where the problem could be, this is completely beyond me.

 

Mods feel free to move this if it's in the wrong place - couldn't quite decide if I need PHP help or server help!

Link to comment
https://forums.phpfreaks.com/topic/175476-image-processing-conundrum/
Share on other sites

Only jpg files can be uploaded by design, so it can't be a filetype problem. Sometimes if a different machine is used, the exact same file can be uploaded and then processed properly, so I'm confident there aren't any problems with the functions that are being used, something else strange is going on.

 

Honestly, script time-out is my only idea at this point, but even that doesn't make a lot of sense given that the problem is so sporadic.

Without seeing any code anything is going to be guess work, if its the resize script then its likely to be a timeout or memory, you can probably remove that possibility but asking the client to upload a file, that you have already uploaded and tested (a very small jpeg),

checking the error logs may reveal the problem, or you could even echo a message at different parts ie

File uploaded

FileType Check

FileType Passed

File moved

File Resized

File added to database

etc

 

Yeah, it's all guess-work for me, too, especially since I can't replicate the problem at all! ;)

 

I'm calling imagedestroy() at the end of the resize, but I guess the problems are starting before it even gets to that point. Good call on the error logs, I'll enable those and see what transpires.

 

Thanks!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.