0

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">&#160;</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>&#160;</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>
3
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by almostbob
0

If you are running on Linux, it doesn't treat upper and lower case as the same thing. Either your upload routine has to force everything to lower case (or upper if you prefer) or the display routine has to look for both variations. I didn't go through your code but that is the most likely reason.

0

what crishea said
assume all servers servers are case sensitive,
windows servers arent, but with good fortune you'll never have to work on a windows server,
caveBob say ugg apache linux good, ugg windows bad

have your file upload script force all filenames to the form your server understands
line 6 in the op above something like

$FullSavePath = $ImagesDirectory.strtolower($FileName);

Edited by almostbob: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.