PHP photo upload issue

Discussion in 'PHP' started by jadencollege, Sep 11, 2011.

  1. #1
    okay hopefully someone can help me with this issue...i have a picture upload functionality for my website, but ever since i tried uploading a file, it brings up this error message. Does anybody know what is wrong ? and if so i would appreciate your help.
    Here is file/code that corresponds with the photo functionality and error. it is called changephoto.phtml


    
    <?php $this->placeholder("pagecontent")->captureStart(); ?>
    <div id="navpanel">
        <a href="<?php echo $this->appbasepath.'/' ?>"><?php if($this->enablecustomtext){if(isset($this->statictext)){$node = $this->statictext->xpath("/statictexts/normaltext/entry[@ID='24']/replaced"); echo $node[0];}else{echo 'Home';}}else{echo 'Home';} ?></a> &gt; <a href="<?php echo $this->url(array(), 'myprofile', true) ?>"><?php if($this->enablecustomtext){if(isset($this->statictext)){$node = $this->statictext->xpath("/statictexts/normaltext/entry[@ID='10']/replaced"); echo $node[0];}else{echo 'My Profile';}}else{echo 'My Profile';} ?></a> &gt; <span class="pagetitle"><?php if($this->enablecustomtext){if(isset($this->statictext)){$node = $this->statictext->xpath("/statictexts/normaltext/entry[@ID='63']/replaced"); echo $node[0];}else{echo 'Change Photo';}}else{echo 'Change Photo';} ?></span>
    </div>
    <?php if(isset($this->formdata->adplaceholder6) && $this->formdata->adplaceholder6->isactive == true){ ?>
    <div id="adplaceholder6">
        <?php echo $this->formdata->adplaceholder6->content ?>
    </div>
    <?php } ?>
    <div style="padding: 10px;">
        <!-- start# right panel -->
        <div style="float: right; width: 220px; text-align: left;">
            <?php if(isset($this->formdata->adplaceholder5) && $this->formdata->adplaceholder5->isactive == true){ ?>
            <div id="adplaceholder5">
                <?php echo $this->formdata->adplaceholder5->content ?>
            </div>
            <?php } ?>
        </div>
        <!-- end# right panel -->
        <form id="frm" method="post" enctype="multipart/form-data">
            <input type="hidden" name="posted" value="1" />
            <input type="hidden" name="frmAction" value="<?php echo isset($this->formdata->frmAction) ? $this->formdata->frmAction : '' ?>" />        
            <div id="profilepanel">
                <?php echo isset($this->errormsg) ? '<div class="error">### '.$this->errormsg.' ###</div>' : '' ?>
                <span style="font-size: 8pt; font-style: italic">
                    <?php if($this->enablecustomtext){if(isset($this->statictext)){$node = $this->statictext->xpath("/statictexts/normaltext/entry[@ID='64']/replaced"); echo $node[0];}else{echo 'Changing photo is 2 step procedure. First you  have to upload the photo, and then crop it.';}}else{echo 'Changing photo is 2 step procedure. First you  have to upload the photo, and then crop it.';} ?>
                </span>
                <br /><br />
                <fieldset>
                    <legend>&nbsp;<img alt="" src="<?php echo $this->appbasepath ?>/images/photo.png" style="vertical-align: middle;" />&nbsp;<strong><?php if($this->enablecustomtext){if(isset($this->statictext)){$node = $this->statictext->xpath("/statictexts/normaltext/entry[@ID='65']/replaced"); echo $node[0];}else{echo 'Upload Photo';}}else{echo 'Upload Photo';} ?></strong>&nbsp;</legend>
                    <div style="padding: 5px;">
                        <span class="fieldheader"><?php if($this->enablecustomtext){if(isset($this->statictext)){$node = $this->statictext->xpath("/statictexts/normaltext/entry[@ID='66']/replaced"); echo $node[0];}else{echo 'Specify Photo';}}else{echo 'Specify Photo';} ?></span> <input type="file" name="photo" class="textbox" style="width: 350px;" />   
                    </div>
                </fieldset>
            </div>
            <div style="text-align: center; width: 65%; padding-left: 10px; padding-right: 10px; padding-top: 5px;">
                <button type="submit" class="frmbttn"><img alt="" src="<?php echo $this->appbasepath ?>/images/upload.png" /> <?php if($this->enablecustomtext){if(isset($this->statictext)){$node = $this->statictext->xpath("/statictexts/normaltext/entry[@ID='67']/replaced"); echo $node[0];}else{echo 'Upload';}}else{echo 'Upload';} ?></button>
                <button type="reset" class="frmbttn"><img alt="" src="<?php echo $this->appbasepath ?>/images/reset.png" /> <?php if($this->enablecustomtext){if(isset($this->statictext)){$node = $this->statictext->xpath("/statictexts/normaltext/entry[@ID='55']/replaced"); echo $node[0];}else{echo 'Reset Form';}}else{echo 'Reset Form';} ?></button>
            </div>
        </form>
        <div style="clear: both;"></div>
    </div>
    <?php $this->placeholder("pagecontent")->captureEnd(); ?>
    PHP:

     
    Last edited: Sep 11, 2011
    jadencollege, Sep 11, 2011 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    What is the error message? then i could look into your code :)
     
    EricBruggema, Sep 12, 2011 IP
  3. JohnnySchultz

    JohnnySchultz Peon

    Messages:
    277
    Likes Received:
    4
    Best Answers:
    7
    Trophy Points:
    0
    #3

    the code you posted has no relevance in the upload functionality, it will just display the upload form.
    maybe post a screenshot of the page displaying the error?
     
    JohnnySchultz, Sep 12, 2011 IP
  4. jadencollege

    jadencollege Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The error this code brings is: ### Failed to upload photo. Please re-try again. ###
     
    jadencollege, Sep 12, 2011 IP
  5. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #5
    We'd have to see the upload code to help you.
     
    Rukbat, Sep 12, 2011 IP
  6. sunsriinfosys

    sunsriinfosys Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Try to upload a small file, the problem might be with the large file size.
     
    sunsriinfosys, Sep 12, 2011 IP
  7. JohnnySchultz

    JohnnySchultz Peon

    Messages:
    277
    Likes Received:
    4
    Best Answers:
    7
    Trophy Points:
    0
    #7
    this line of code displays that part..
    <?php echo isset($this->errormsg) ? '<div class="error">### '.$this->errormsg.' ###</div>' : '' ?>
    PHP:
    but we still need the uploading script in which $this->errormsg is set..

    what PHP framework are you using or CMS?
     
    JohnnySchultz, Sep 13, 2011 IP