When members upload a picture to their profiles if the extension is .jpg, or .png everything is fine; however, if the extension is all uppercase .JPG or .PNG, the photo still uploads but doesn’t display.
What could be causing this? I’ve pasted some code below but I’m not sure if it’s the exact place where the problem is accruing. Let me know if you need to see anything else. The site uses html, php, xml, and js.
Thanks
php code for page where members upload photos:
if($inpAction == "Upload") {
//prepare destination path
$ImagesDirectory = Footprint::FilePath("_MEDIA/photos/");
$FileInfo = pathinfo(Footprint::$Request->File("file")->FileName);
$FileName = "img_". rand() .".". ($FileInfo["extension"] == "" ? "jpg" : $FileInfo["extension"]);
$FullSavePath = $ImagesDirectory . $FileName;
chmod($ImagesDirectory, 0755);
//save file
Footprint::$Request->File("file")->SaveAs($FullSavePath);
//create new listing photo
Footprint::$DB->SQLCommand = Footprint::$SQL->GetCommand("create-new-photo", Footprint::FilePath("account/profile.sql.xml"));
Footprint::$DB->SQLKey("%fk_user_id%", Footprint::$Request->Session("user_id"));
Footprint::$DB->SQLKey("%label%", ($inpLabel == "" ? "N/A" : $inpLabel));
Footprint::$DB->SQLKey("%filename%", $FileName);
Footprint::$DB->ExecuteNonQuery();
html code where members upload photos:
<fieldset data-label="photo_container">
<legend>Photos</legend>
<form action="" method="post" name="form" id="form" enctype="multipart/form-data" data-label="photo_upload_form">
<table border="0" cellpadding="3" cellspacing="0" class="form">
<tr>
<td class="field_label"><img src="../_MEDIA/icon-required.gif" alt="Required Field" width="15" height="15" align="absmiddle" /> Label:</td>
<td class="field"><input type="text" value="" maxlength="255" size="25" name="label" data-field="label"/></td>
</tr>
<tr>
<td valign="top" class="field_label"><img src="../_MEDIA/icon-required.gif" alt="Required Field" width="15" height="15" align="absmiddle" /> Photo:</td>
<td class="field"><input type="file" name="file" data-field="file"/><br />
<span style="color:#666; font-size:12px;">Photos can be .jpg or .png <br />
(file title should have no-spaces and be all lowercase letters)</span></td>
</tr>
<tr>
<td class="label"> </td>
<td class="field"><input type="submit" value="Upload" name="action" data-field="button_upload"/></td>
</tr>
</table>
<hr />
</form>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="results">
<tr class="header">
<td>Photo</td>
<td>Label</td>
<td> </td>
</tr>
<tr data-label="blank_results_row">
<form action="" method="post" name="form" id="form">
<td><a target="_blank" data-label="photo_link"><img border="0" data-label="photo_path" alt="photo_path" /></a></td>
<td data-label="label">label</td>
<td class="wrap_text max_width"><input data-field="button_photo_delete" type="submit" value="Delete Photo" name="action"/>
<input data-field="account_photo_id" type="hidden" value="" name="account_photo_id"/>
</td>
</form>
</tr>
<tr data-label="no_results_row">
<td colspan="7"><h3>No photos found.</h3></td>
</tr>
</table>
<!--xslt-include href="../../_GLOBAL/paging-table.html"-->
</fieldset>