Photo Upload Failed

If anyone can help me troubleshoot this I would greatly appreciate it.

When I go to upload an image in the photo module I receive the error "photo upload failed (photo error)".  This error occurs regardless of the type of upload that I do (Flash, Regular, etc...).  I've looked at ever other post regarding this and have followed any advice / solutions there to no avail.  It may be of note that the avatar photo module works during registration and will upload an image and display it.  I've have all of the permissions on the folders beneath .../media/images set to write.

I'm running the site on IIS 6.0 Windows 2003 Server.

Dolphin 7.0

Please let me know if you need any more information to help me trouble shoot this.

Thank you so much for your help in advance!

This was a latest advice i had got when i posted that my videos don work, and fellow said me to use "ffmpeg" built specially for windows, as the ffmpeg file with Dolphin7 is for linux.... check out...

This was a latest advice i had got when i posted that my videos don work, and fellow said me to use "ffmpeg" built specially for windows, as the ffmpeg file with Dolphin7 is for linux.... check out...

Thank you so much for your reply mahaveersingh

I have replaced the ffmpeg that comes with the dolphin7 package with the one for windows, but I'll try looking at this further to see if ffmpeg is the cause I doubt it though.

Hello


Well am no expert but are you getting any emails saying security attack, have you installed any mod, if so what is the error message saying exactly.

Best bet is to show that error message to your agent, sure he will be able to point you in the right direction as to what is caousing that error.

Sal

Hello


Well am no expert but are you getting any emails saying security attack, have you installed any mod, if so what is the error message saying exactly.

Best bet is to show that error message to your agent, sure he will be able to point you in the right direction as to what is caousing that error.

Sal

Hi Sal,


No I'm not receiving any emails saying security attack, and I have installed any modules other than boonex modules: avatar, chat, membership, Messenger, Orca Forum, payments, photos (obviously), and profile map.  I'm not receiving any errors other than the ambiguous "photo upload failed (photo error)" I wish I was seeing some sort of detailed error that I could debug.  I've also checked the error_log.txt and there is nothing there as well.  I haven't been able to get hold of any agents.  Thank you for your input though Sal I do appreciate it!

well in that case just ask one of the experienced developers on hear, sorry culd'nt be much help I was just mailing from my own experience of problems I'v had

Anyone with a solution to this?  I really need to get this working yesterday.  I'll also be purchasing a full license at $1000 if I can get this working we'll want all the rebranding rights.  But I'd like to see a little support to installation problem.  I haven't been able to get a hold of a Boonex Agent.  I'll gladly pay someone to help sort this out...

IIS_IUSERS have full control on the wwwroot folder ?

during the dolphin install did it say gdlibrary found or imagemagic ?

FFMPEG has nothing to do with PHOTO uploads.

http://dolphin-techs.com

dolphin-techs.com - Live Tech Support and Dolphin Hosting

Hi Jay,


Thank you for taking the time to give me some input!  I wouldn't think that IIS_IUSERS would need full control over the entire site, but in the interest of figuring this out, I gave IIS_IUSERS full control and restarted IIS.  There wasn't any change in the upload outcome, same error.  GD is installed here's part of a screen shot from the Host Tools PHPinfo in the Admin Panel.

PHPInfo Partial Screen Shot

Any other ideas?  Like I said the avatar images are uploading just fine and being cropped so GD must be functioning properly.  Is there a switch somewhere in the upload code for the photos module I can turn on to get more detailed errors?

Thanks again for the help!!!

you can have a look in the iis server logs if event error logging is turned on.  it might help a bit.  is this a live server or just something you have at home ?

dolphin-techs.com - Live Tech Support and Dolphin Hosting

you can have a look in the iis server logs if event error logging is turned on.  it might help a bit.  is this a live server or just something you have at home ?

The server is live, it's a Windows 2003 Server running IIS 6.0.  Logging is turned on but I'm not seeing anything in there that could be helpful...


Any other suggestions?

Upgrade to IIS 7 ?   Kidding.  I have no other ideas for you.  I am running IIS 7 on windows 7 and do not have this problem.  Is this a dolphin 6 upgrade or clean dolphin 7 install ?  not sure if that even matters.

dolphin-techs.com - Live Tech Support and Dolphin Hosting

How big is the image you are trying to upload?

GD_lib has a limit on the size of image that it can handle - so even if you have increased your memory limit in php.ini, it may still be too large for gd_lib to handle.

/DM

Dolphin - Ajax Masturbation

(Assuming you are running apache)

Dolphin - Ajax Masturbation

Upgrade to IIS 7 ?   Kidding.  I have no other ideas for you.  I am running IIS 7 on windows 7 and do not have this problem.  Is this a dolphin 6 upgrade or clean dolphin 7 install ?  not sure if that even matters.

Soon my friend very soon, we'll be upgrading to IIS 7.  It's a clean dolphin 7 install...  I just haven't a clue why it won't upload...  Especially since the avatar images are uploading and being manipulated just fine.  Thanks for your input though!!!  Really appreciate it!!!


Anyone know what's going on with this error?  Why you would receive it?

How big is the image you are trying to upload?

GD_lib has a limit on the size of image that it can handle - so even if you have increased your memory limit in php.ini, it may still be too large for gd_lib to handle.

/DM

My test images are 1 meg or less...  I'm running Windows 2003 Server IIS version 6.0

1 meg is a pretty big image for the web, unless you are offering stock images for download.

Just for a test resize it to 800x600 as a jpg - should come out no bigger than a few hundred K.

See what happens

/DM

Dolphin - Ajax Masturbation

1 meg is a pretty big image for the web, unless you are offering stock images for download.

Just for a test resize it to 800x600 as a jpg - should come out no bigger than a few hundred K.

See what happens

/DM

I have been testing with an image that is 32.6kb and 600x450.  Still the same result...  Does anyone know what exactly causes this error to show what the if statement is that causes it to appear?

What filename are you using?

Dolphin - Ajax Masturbation

What filename are you using?

test.jpg

Mnn not sure what else to suggest. Without any other log messages or direct access, it's tricky thing to diagnose.

Only other thing I can think of to make sure that the temp folder in your server configuration is set correctly as this is actually used to upload the file to before it is moved to it's destination - the fact that the avatar uploading is working would seem to say that it should be fine, but it doesn't hurt to check.

FYI

The photo uploading is taken care of in the following file

/modules/boonex/photos/classes/BxPhotosUploader.php

All I can suggest is that you might want to try setting some break points to determine what's causing the error.

/DM

Dolphin - Ajax Masturbation

Looks like my problem is occuring somewhere with this piece of code in BxPhotosUploader.php starting on line 278:

[code]

function _recordPhoto() {
$sAuthorCheck = $this->checkAuthorBeforeAdd();
if(empty($sAuthorCheck)) {
global $sFilesPath;
$sRecordThumbUrl = photo_getRecordThumbnail($this->_getAuthorId());
if($sRecordThumbUrl) {
$aDefault = array('image' => $sRecordThumbUrl, 'type' => "record");
return $this->GenSendFileInfoForm(1, $aDefault);
} else
return $this->getPhotoAddError();
}
else
return $sAuthorCheck;
}

function getPhotoAddError() {
return '<script type="text/;</script>';
}

[/code]

Any ideas???


Also how do I post code in the forums properly?  I tried searching the forums and googling it but nothing came up.

Actually scratch that it's coming from the block above that starting on line 260.  I came to this conclusion by commenting out the "getPhotoAddError" function and the if statement below is where the code asked for the function.  Any thoughts on where it's breaking in there or what to try? Laughing

function _sharePhoto($sFilePath, $isMoveUploadedFile = true, $sRealFilename = '') {
$sAuthorCheck = $this->checkAuthorBeforeAdd();
if(empty($sAuthorCheck)) {
$iPointPos = strrpos($sRealFilename, '.');
$sExt = substr($sRealFilename, $iPointPos + 1);
if (!$this->oModule->_oConfig->checkAllowedExts(strtolower($sExt)))
return $this->getPhotoAddError();
$this->sTempFilename = substr($sRealFilename, 0, $iPointPos);
$iMID = $this->performPhotoUpload($sFilePath, array(), false, $isMoveUploadedFile);
if ($iMID>0) { //upload success
$aDefault = array('title' => $this->sTempFilename, 'description' => $this->sTempFilename);
return $this->GenSendFileInfoForm($iMID, $aDefault);
} else
return $this->getPhotoAddError();
} else
return $sAuthorCheck;
}

function _recordPhoto() {
$sAuthorCheck = $this->checkAuthorBeforeAdd();
if(empty($sAuthorCheck)) {
global $sFilesPath;
$sRecordThumbUrl = photo_getRecordThumbnail($this->_getAuthorId());
if($sRecordThumbUrl) {
$aDefault = array('image' => $sRecordThumbUrl, 'type' => "record");
return $this->GenSendFileInfoForm(1, $aDefault);
} else
return $this->getPhotoAddError();
}
else
return $sAuthorCheck;
}

function getPhotoAddError() {
return '<script type="text/;</script>';
}

Alright I've got it down to one block of code that the error is coming from isn't there anyone that can walk me through what this code is doing and where the problem might be?  I still haven't heard from my Boonex Agent...

Alright I've got it down to one block of code that the error is coming from isn't there anyone that can walk me through what this code is doing and where the problem might be?  I still haven't heard from my Boonex Agent...

Can you post the code?

The other code you listed basically will return the error if the file extension is not allowed or if the file transfer fails.

It gets the file extension by splitting the filename up at the first '.' and then using everything to the right of it - this will obviously break if the filename has a '.' in it - hence reason for my earlier question.

The file transfer itself is handled by a separate function - performPhotoUpload() if this function returns an error then the message will also be displayed. if this is the case then you will need to look within the function itself to determine why. (One possibility is the temp folder previously mentioned).

Post the code and I will try to help

/DM

Dolphin - Ajax Masturbation

I've narrowed down the block of code that is causing the problem to the block beginning on line 260 of root/modules/photos/classes/BXPhotosUploader.php.

Code:
function _sharePhoto($sFilePath, $isMoveUploadedFile = true, $sRealFilename = '') {
$sAuthorCheck = $this->checkAuthorBeforeAdd();
if(empty($sAuthorCheck)) {
$iPointPos = strrpos($sRealFilename, '.');
$sExt = substr($sRealFilename, $iPointPos + 1);
if (!$this->oModule->_oConfig->checkAllowedExts(strtolower($sExt)))
return $this->getPhotoAddError();
$this->sTempFilename = substr($sRealFilename, 0, $iPointPos);
$iMID = $this->performPhotoUpload($sFilePath, array(), false, $isMoveUploadedFile);
if ($iMID>0) { //upload success
$aDefault = array('title' => $this->sTempFilename, 'description' => $this->sTempFilename);
return $this->GenSendFileInfoForm($iMID, $aDefault);
} else
return $this->getPhotoAddError();
} else
return $sAuthorCheck;
}

The error occurs from the IF statement beginning on line 269.

First off - root/modules/photos/classes/BXPhotosUploader.php. is incorrect - it should be - root/modules/boonex/photos/classes/BXPhotosUploader.php. Hopefully this is just a typo. ;)

The line you mention is the call for the function - performPhotoUpload() this basically runs some code defined elsewhere. Functions are used where code is reused by different parts of the script, it saves writing out the same thing x amount of times.

As well as performing various tasks, a function can also return a value - that is what is happening in this case

$iMID = $this->performPhotoUpload($sFilePath, array(), false, $isMoveUploadedFile);
if ($iMID>0) { //upload success
$aDefault = array('title' => $this->sTempFilename, 'description' => $this->sTempFilename);
return $this->GenSendFileInfoForm($iMID, $aDefault);
} else
return $this->getPhotoAddError();

What this is basically saying is let $iMID equal the result of the photo upload function - The performPhotoUpload function returns a value that will equate to success / failure / some other result.

In this case if the value is greater than 0 then the transfer is a success.

So to find out what is causing the issue, you need to look within the performPhotoUpload function and do a little more testing.

First things - find where the function is defined - to do this you will need to be able to search in files (not something that windows is particularly good at natively). Search for the text `function performPhotoUpload(` in this case the function is actually defined in the same file - on about line 312.

Looking through the function, there are several things that will return an error (look for the lines that say `return false`) my best advice is to carry on testing using the method you have used so for to determine what line the issue arises from and then post back here.

One thing that does stick out is the CHMOD command on line 342 - not really sure how this is handled under windows as there is no direct translation between Unix modes and Windows permissions. Cannot recall CHMODing anything when I used to run Apache under windows.

Anyhows, let us know how you get on.

/DM

P.S. After years of running an AMP stack on my windows machine, I succumbed to Linux. Unless your hands are tied using SBS2003 it really is the best environment for running websites. My recommendation is Ubuntu, it's free and very capable, and may provide a better solution if the issue turns out to be IIS / SBS2003 related. Happy to help assist you with setting it up if you like. http://www.deeemm.com/blog/78-lamp-not-wamp.html

;)

Dolphin - Ajax Masturbation

I can say its not related to sbs2003 per say as i have ran dolphin one server 2003  server 2008  windows xp  windows vista and windows 7 under IIS6 and 7.  IIS 6 was a big pain in the ass to get going but it did work.  IIS 7 is a little more forgiving.

Have you checked to see if the photos are at least being uploaded and just not converted ?   /root/modules/photos/data/files   look for 1.jpg then 1_m.jpg     2.jpg 2_m.jpg.....

dolphin-techs.com - Live Tech Support and Dolphin Hosting

Can't believe it took that many posts to finally get the infamous "You may want to think about moving to Linux..."  I'm just giving you a hard time @DeeEmm Laughing!!!  I would if it was my decision but alas, I'm new at the company and it is not.  I am a windows fan but I've seen in the past few years with the value of open source scripts how Linux just makes life easier...


First seriously thank you guys for your continuing help!!!


@DeeEmm:  I'm working through the "Simple Upload" function right now to see if anything sticks out...  I'm not sure if this is going to be as easy to debug because on the function I just commented out the "getPhotoAddError" function and it lead me right to the line were the code was asking for it.  Don't really know how I'm going to go about debugging the "Simple Upload" function just yet.

FYI: I'm running Windows Server 2003 not SBS (Don't think it really matters much they're built on the same basic platform)

You were also right on the typo you mentioned in the beginning of your post it was a typo.

@DolphinJay:  I didn't have a folder inside my data folder called "files" I created one just in case that may have been the issue (it was not) but my files go into .../modules/boonex/photos/data/files I can tell because the "Shoot" Upload option works just fine and that's where the files drop in.

So the files are not even being uploaded so that should shorten the amount of code I have to go through on the "Simple Upload" function which is seemly become an oxymoron...


I'll report back in a bit...

Thanks Again!!!

Can't believe it took that many posts to finally get the infamous "You may want to think about moving to Linux..."

Haha - I'm not paying you out (although I like to have a little dig at windows users where I can ;) )

The code you need to concentrate on is just the code within the function - that is everything between the following lines (not meaning to try and teach you how to suck eggs)

// simple upload
function performPhotoUpload($sTmpFile, $aFileInfo, $bAutoAssign2Profile = false, $isMoveUploadedFile = true, $iChangingPhotoID = 0, $iAuthorId = 0
...
...
...
return $iLastID;
}


I find that rather than commenting out code, it is more helpful to use breakpoints - this is mostly used in IDE's such as Visual Basic / C# / etc, but as this is one of the ways I was brought up I find it a useful tool in PHP too. I use a function that I have custom written for debugging that I insert as a breakpoint - this can be set to return all kinds of variables / data etc.

A more basic version is to simply do as follows...

If you want to find out the value of a variable at a certain point in the script simply use the print_r() function. like this

print_r '#' . $yourvariablename . '#';

You should find that the variable name is printed at the top of the screen. You might need to also stop execution of the script at this point - to do this simply use the exit command.

print_r '#' . $yourvariablename . '<br>';
exit;

The hashes are added to the beginning and the line break to the end of the variable value to make it easier to see and also so that it shows something even if the value is NULL.

print_r() is better then echo() as it will actually print the contents of arrays, whereas echo() will simply print that it is an array.

Now this may or may not work - depending on a number of factors - where you put this in the code, how the code being called is executed etc - all of which are a bit outside the scope of I am prepared to write here, but as a guide you could try the following. (not the simplest way, but the easiest I can think of explaining)

For each instance of 'return false' in the performPhotoUpload() function change it to a unique value -

return 'one';
...
return 'two';
...
return 'three';

Then where the function is called - in the original piece of code we looked at - print the value returned by the function. Make sure that in this case you stop the execution of the script as the values you added above will cause the script to think that it has successfully uploaded the image.

So in addition to adding the unique values above, the add the following lines to the function _sharePhoto()

function _sharePhoto($sFilePath, $isMoveUploadedFile = true, $sRealFilename = '') {
$sAuthorCheck = $this->checkAuthorBeforeAdd();
if(empty($sAuthorCheck)) {
$iPointPos = strrpos($sRealFilename, '.');
$sExt = substr($sRealFilename, $iPointPos + 1);
if (!$this->oModule->_oConfig->checkAllowedExts(strtolower($sExt)))
return $this->getPhotoAddError();
$this->sTempFilename = substr($sRealFilename, 0, $iPointPos);           
$iMID = $this->performPhotoUpload($sFilePath, array(), false, $isMoveUploadedFile);
print_r '#' . $iMID . '<br>';
exit;

if ($iMID>0) { //upload success
$aDefault = array('title' => $this->sTempFilename, 'description' => $this->sTempFilename);
return $this->GenSendFileInfoForm($iMID, $aDefault);
} else
return $this->getPhotoAddError();
} else
return $sAuthorCheck;
}

Now when trying to upload a photo what should happen is that the script will get to the point where it has attempted to upload the image, fails and will now print out one of the values that you added - 'one', 'two', 'three' etc. This should tell you where in the script the error is originating from.

This may seem a little long winded, but it should definitely work.

An easier option is to selectively replace each 'return false' statement with

print_r 'it is this one';
exit;

But without testing it myself it may or may not return the value.

Anyhows, hopefully there is enough info here to have a little experiment.

Let us know how you get on.

/DM

Dolphin - Ajax Masturbation

DM Thank you so much for your time!!!

I'm going to start debugging with your method right now, I also messaged one of the users that was working on Photos module in the TRAC.  He wanted me find some values to some variables out of it and here's what what I came up with to grab them with some help from Smoge over at modmysite.com.  I'm using the error_log instead of the print_r...

Code:
function _sharePhoto($sFilePath, $isMoveUploadedFile = true, $sRealFilename = '') { //Line 260
$sAuthorCheck = $this->checkAuthorBeforeAdd();
if(empty($sAuthorCheck)) {
$iPointPos = strrpos($sRealFilename, '.');
$sExt = substr($sRealFilename, $iPointPos + 1);
if (!$this->oModule->_oConfig->checkAllowedExts(strtolower($sExt)))
return $this->getPhotoAddError();
$this->sTempFilename = substr($sRealFilename, 0, $iPointPos);
$errormess = "sRealFilename: ".$sRealFilename." | iPointPos: ".$iPointPos." | sExt: ".$sExt." | iMID: ".$iMID." | sFilePath: ".$sFilePath." | isMoveUploadedFile: ".$isMoveUploadedFile."\n";
error_log($errormess, 0);
$iMID = $this->performPhotoUpload($sFilePath, array(), false, $isMoveUploadedFile);
if ($iMID>0) { //upload success
$aDefault = array('title' => $this->sTempFilename, 'description' => $this->sTempFilename);
return $this->GenSendFileInfoForm($iMID, $aDefault);
} else
return $this->getPhotoAddError();
} else
return $sAuthorCheck;
}

and here's what was returned:

Code:
[25-Mar-2010 11:47:55] sRealFilename: test.jpg | iPointPos: 4 | sExt: jpg | iMID: | sFilePath: C:\WINDOWS\Temp\php310.tmp | isMoveUploadedFile: 1

Any smoking guns from just this???

That looks as it should, however, this is being generated prior to the error.

Did you check permissions on the temp directory?

C:\WINDOWS\Temp\

From memory, when setting up PHP, if the temp directory is not explicitly defined it defaults to system temp folder as it seems to be here.

Do IIS_IUSERS have write access to this folder?

Might be worth checking what is in the php.ini file for the upload_tmp_dir setting.

/DM

Dolphin - Ajax Masturbation

Man, I can't believe the brain damage you guys are going through with this. I have been working with IIS 6.0 SP4 (I think) for many years now and I have only one thing to say.

 

WHY ARE YOU WASTING YOUR TIME?

 

Even if you get it all to run by some magical feat of Gatesmanship, it won't last! At some point, you will be forced to admit defeat and build a Linux or similar box so you can actually enjoy the fruits of your labor with Dolphin. If you think I am kidding you, just finish what you are doing, then do your VS 7 IIS upgrade and watch the whole thing disappear like the house in AmityVille Horror.

Visit my Dolphin site at http://towtalk.net ... Hosted by Zarconia.net!

Resolved!

So I tried to go through the debugging process as suggested by @DeeEmm and wasn't getting any response from any of the steps in that I inserted the debugging code inplace of "return false".  So I ended up changing my upload temp folder in my php.ini (upload_tmp_dir) to the tmp folder.  That didn't work so I created a new folder called "temp" in my dolphin root and then uninstalled the photos module.  I then wrote over the photo modules with the original files (more so to make sure I didn't leave in any of my debugging code).  Reinstalled the photo module and as they say "Bob's your Uncle".  All of the upload functions are working flawlessly now.

I think it boiled down to the upload folder being incorrectly configured in my php.ini (upload_tmp_dir) and some sort of corruption with my original tmp file...


Thank you to everyone for your help especially @DeeEmm!


On a side note @SkyForum that's just not at all helpful.  Not everyone has the luxury to change their hosting setups...  Obviously Dolphin would run better on Linux and make my life easier, but at the moment it's not a possiblity.

Hey good job on your finding.  I dont see any problem with IIS 6 or 7.  Every server has its plus and minus.  i suppose i could list 100 things i hate about linux as well. And list 200 things i love about windows. 

Anyway good luck with your new dolphin install and if you have any more questions fell free to ask away.

dolphin-techs.com - Live Tech Support and Dolphin Hosting
Forums  ›  Archive  ›  Dolphin 7.0