473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

problem while uploading image.

254 100+
Expand|Select|Wrap|Line Numbers
  1. <table width="85%" height="32" border="0" align="left" cellpadding="0" cellspacing="0">
  2.       <tr valign="bottom">
  3.         <td width="21%" align="left" valign="middle">Caption1</td>
  4.         <td width="20%" align="left" valign="middle"><input name="Image_Name1" type="text" id="Image_Name1" value="" size="15" /></td>
  5.         <td width="15%" align="center" valign="middle">File1: </td>
  6.         <td width="44%" align="left" valign="middle"><input name="File1" type="file" id="File1" value="" size="15" /></td>
  7.       </tr>
  8.       <tr valign="bottom">
  9.         <td width="21%" align="left" valign="middle">Caption2</td>
  10.         <td width="20%" align="left" valign="middle"><input name="Image_Name2" type="text" id="Image_Name2" value="" size="15" /></td>
  11.         <td width="15%" align="center" valign="middle">File2:</td>
  12.         <td width="44%" align="left" valign="middle"><input name="File2" type="file" id="File2" value="" size="15" /></td>
  13.       </tr>
  14.       <tr valign="bottom">
  15.         <td width="21%" align="left" valign="middle"> Caption3</td>
  16.         <td width="20%" align="left" valign="middle"><input name="Image_Name3" type="text" id="Image_Name3" value="" size="15" /></td>
  17.         <td width="15%" align="center" valign="middle">File3:</td>
  18.         <td width="44%" align="left" valign="middle"><input name="File3" type="file" id="File3" value="" size="15" /></td>
  19.       </tr>
  20.       <tr valign="bottom">
  21.         <td width="21%" align="left" valign="middle"> Caption4</td>
  22.         <td width="20%" align="left" valign="middle"><input name="Image_Name4" type="text" id="Image_Name4" value="" size="15" /></td>
  23.         <td width="15%" align="center" valign="middle">File4:</td>
  24.         <td width="44%" align="left" valign="middle"><input name="File4" type="file" id="File4" value="" size="15" /></td>
  25.       </tr>
  26.       <tr>
  27.         <td height="26" align="left" valign="middle">&nbsp;</td>
  28.         <td height="26" colspan="2" align="left" valign="bottom"><input type="submit" name="Upload" value="Upload"/>
  29.             <input type="reset" name="Reset" /></td>
  30.       </tr>
  31.       <tr>
  32.         <td></td>
  33.       </tr>
  34.     </table>
  35.  
Expand|Select|Wrap|Line Numbers
  1. if(isset($_POST['Upload']))
  2.     {
  3. for($i=1;$i<=4;$i++)
  4.         {
  5.             $_Image_Name.$i=$_POST['Image_Name'.$i];
  6.             $_File_Name.$i=$_POST['File'.$i]['name'];;
  7.             $_File_Size.$i=$_POST['File'.$i]['size'];
  8.             $_File_Type.$i=$_POST['File'.$i]['type'];
  9.             $_Image_Name=$_Image_Dir.$_File_Name.$i;
  10.             $abc=$i;
  11.             if(empty($_File_Name.$i))
  12.             {
  13.                 break;            }
  14.             else
  15.             {
  16.                             move_uploaded_file($_FILES['$_File_Name'.$i]['tmp_name'],$_Image_Name) or die("Could Not Upload".$_File_Name.$i);
  17.                 $_Insert_Image=mysql_query("INSERT INTO image_master VALUES($Page_Id,null, '$Image_Name'".$i.", '$_File_Type'".$i", '$_File_Size'".$i.",'$_Image_Name','$today')");
  18.             }
  19.                     }
  20.  
image file is not uploade. and showing some error as well.

please, if some one can help me!
Dec 26 '07 #1
4 1448
Atli
5,058 Expert 4TB
Hi.

Please post your code examples inside [code] tags! It's is barely possible to read without them.

To use uploaded files, you should use the $_FILES super-global rather than the $_POST super-global.

Also, the "$_Image_Name.$i" is most likely causing parse errors.
Try using an array instead.

It would also help to see the errors you are getting.
Dec 26 '07 #2
mukeshrasm
254 100+
Hi.

Please post your code examples inside [code] tags! It's is barely possible to read without them.

To use uploaded files, you should use the $_FILES super-global rather than the $_POST super-global.

Also, the "$_Image_Name.$i" is most likely causing parse errors.
Try using an array instead.

It would also help to see the errors you are getting.

If you can do some modification to this code then it would be better for me. I am new to php

Thanks
Dec 26 '07 #3
Markus
6,050 Expert 4TB
If you can do some modification to this code then it would be better for me. I am new to php

Thanks
Helping and assisting are the fundamental keys of this forum - people wont just write the code for you.

If you could show us the errors you are getting it woupld be better for us ;)

Also, do what atli said - uploaded files arent passed through the $_POST super-global; $_FILES is where it's at.

:)

markus.
Dec 26 '07 #4
mukeshrasm
254 100+
Helping and assisting are the fundamental keys of this forum - people wont just write the code for you.

If you could show us the errors you are getting it woupld be better for us ;)

Also, do what atli said - uploaded files arent passed through the $_POST super-global; $_FILES is where it's at.

:)

markus.
Hi

I have done that and code is working fine now.

Now I got one more problem I converted jpeg image to thumbnail. it is working as well but when I click the thumbnail image it is not in openning bigger size as thumbnails images get viewed. Do I need to write some code for that to view the image in bigger size.I don't want to view it in Popup window.

How can I do that?
Dec 27 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Ralph Freshour | last post by:
I'm trying to code the ability for my users to upload up to photo's to mysql database - can someone point me in the right direction as to how this might be done in php? Perhaps a tutorial or some...
5
by: ok | last post by:
Hello, Q: How do I get image width and height before uploading an image? This because, I want to restrict people uploading huge files. Thanks in advance
7
by: lion | last post by:
I get these errors when uploading images via a web page: (the page still uploads the images but reports these errors?) Warning: fopen(D:\php\uploadtemp\php1FC7.tmp) : failed to create stream: No...
3
by: Pitcairnia | last post by:
The basic purpose of the site is for authenticated users to post event listings, which often include photographs. The user is faced with a page where they can insert all of the information about...
4
by: Himanshu | last post by:
hi, Can anybody tell me that thru asp.net using c#, how can we upload and download physical files in any table of SQL Server Database. the uploading part is running successfully but the...
4
by: Ramakrishnan Nagarajan | last post by:
Hi, I am facing a different problem in my application. In that I am uploading a folder that contain only images. Everything was done and was working fine too. When I executed the application using...
2
by: prakharv | last post by:
Hi All, Below is the code which I am using to upload a jpeg file to the server. But the problem I am facing is that it is not copying the entire contents of the image file to the webserver and it...
7
by: dasrasmikant | last post by:
Dear Experts, I am falling in a trouble and need your help for solving it I want to get the width and heignt of an image before uploading it. Below is my code <script language="javascript">...
2
kamill
by: kamill | last post by:
Dear All, I am uploading a image file and after resize the image i am saving it. My script is working fine with small size images but when i am trying to upload big size image, i am getting below...
1
pezholio
by: pezholio | last post by:
Hi, It seems that every time I put together a new script to upload a file I always have problems, here's the latest one: I've got a form with two file input fields, when I submit the form,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.