Jump to content

problem with uploading images using php


sandhya

Recommended Posts

Hi all..,

      I"ve a form to upload images to a photo gallery. While uploading the image it didn't worked. I "ve tried to echo the image name. There i'm getting some path like this instead of getting the image name.

          photo=/tmp/php23PmhX

What could be the problem. Please help me solving this problem.Thanks in advance.   

Link to comment
Share on other sites

<form action="fgallery.php" method="post" enctype="multipart/form-data" name="form1" id="form1" onsubmit="return validate(this);" >

      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">

        <tr>

          <td width="30%" height="34"><div align="right" class="style5 style3 style8">News Category</div></td>

          <td width="5%"><div align="center" class="style5 style3 style8">:</div></td>

  <?

$selcat=executework("select distinct subcategory,id from big_main where category='movie' order by id");

$cntcat=@mysql_num_rows($selcat);

?>

          <td width="65%"><div align="left" class="style7">

            <select name="cat" id="cat">

              <option value="SELECT CATEGORY" selected="selected">SELECT CATEGORY</option>

              <?

while($rowcat=@mysql_fetch_array($selcat))

{

if($rowcat[subcategory]!="")

{

?>

              <option value="<? echo $rowcat[id] ?>" ><? echo $rowcat[subcategory] ?></option>

              <?

}

}

?>

            </select>

                </div></td>

        </tr>

        <tr>

          <td height="36"><div align="right" class="style5"> Head Line</div></td>

          <td><div align="center" class="style5">:</div></td>

          <td><div align="left"><span class="style3"><span class="style3"></span></span><span class="style7">

            <input name="topic" type="text" id="topic" size="50" />

            <span class="style8"> </span></span>              </div> </td>

        </tr>

        <tr>

          <td height="38"><div align="right" class="style5"> Photo 1 </div></td>

          <td><div align="center" class="style5">:</div></td>

          <td><div align="left"><span class="style3"><span class="style3"><span class="style3"><span class="style8"><span class="style8"></span></span></span></span></span>

                  <label>

                  <input name="photos1" type="file" id="photos1" />

                  <input name="capt1" type="text" id="capt1" value="Caption Here........................." size="40" />

                  </label>

          </div></td>

        </tr>

        <tr>

          <td height="38"><div align="right" class="style5"> Photo 2 </div></td>

          <td><div align="center" class="style5">:</div></td>

          <td><div align="left"><span class="style3"><span class="style3"><span class="style3"><span class="style8"><span class="style8"></span></span></span></span></span>

                  <label>

                  <input name="photos2" type="file" id="photos2" />

                  </label>

                  <input name="capt2" type="text" id="capt2" value="Caption Here........................." size="40" />

          </div></td>

        </tr>

        <tr>

          <td height="36"><div align="right" class="style5"> Photo 3 </div></td>

          <td><div align="center" class="style5">:</div></td>

          <td><div align="left"><span class="style3"><span class="style3"><span class="style3"><span class="style8"><span class="style8"></span></span></span></span></span>

                  <label>

                  <input name="photos3" type="file" id="photos3" />

                  </label>

                  <input name="capt3" type="text" id="capt3" value="Caption Here........................." size="40" />

          </div></td>

        </tr>

        <tr>

          <td height="36"><div align="right" class="style5"> Photo 4 </div></td>

          <td><div align="center" class="style5">:</div></td>

          <td><div align="left"><span class="style3"><span class="style3"><span class="style3"><span class="style8"><span class="style8"></span></span></span></span></span>

                  <label>

                  <input name="photos4" type="file" id="photos4" />

                  </label>

                  <input name="capt4" type="text" id="capt4" value="Caption Here........................." size="40" />

          </div></td>

        </tr>

        <tr>

          <td height="27"><div align="right" class="style5"> Photo 5 </div></td>

          <td><div align="center" class="style5">:</div></td>

          <td><div align="left"><span class="style3"><span class="style3"><span class="style3"><span class="style8"><span class="style8"></span></span></span></span></span>

            <label>

            <input name="photos5" type="file" id="photos5" />

            </label>

            <input name="capt5" type="text" id="capt5" value="Caption Here........................." size="40" />

          </div></td>

        </tr>

        <tr>

          <td height="27" colspan="3"><div align="left"><span class="style3"><span class="style3"><span class="style3"><span class="style8"><span class="style8"></span></span></span></span></span>

                  <label></label>

                    </div></td>

          </tr>

        <tr>

          <td height="43" colspan="3"><div align="center"><span class="style3"><span class="style3"></span></span>

              <input type="submit" name="Submit" value="Submit" />

          </div>

            <div align="center"><span class="style3"><span class="style3"></span></span></div>            <div align="left"><span class="style3"><span class="style3"></span></span></div></td>

          </tr>

        <tr>

          <td><div align="right"><span class="style3"><span class="style3"></span></span></div></td>

          <td><div align="center"><span class="style3"><span class="style3"></span></span></div></td>

          <td><div align="left"><span class="style3"><span class="style3"></span></span></div></td>

        </tr>

      </table>

      </form>

 

 

This is the form i created. Using this i'm trying to upload photos. After submitting the form photos are not posting properly. Is there any error in the form?

Link to comment
Share on other sites

Hi

  Go the page you are submitting the data. and just write the below lines.

  for file uploading you should use $_FILES array;

 

 

echo '<pre>';
        print_r($_POST);
print_r($_FILES);
die;

 

  you will all files value in $_FILES array;

 

 

Link to comment
Share on other sites

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.