JoeMann
|
| Posted: 05/19/2003, 11:37 PM |
|
I have read and tried some of the examples for uploading an image file but have not been successful. I would like to hire per say someone to do a sample piece of code, but have a really small budget and don't want to insult anyone.
Here is what I want to do:
Have a form which has item_no, Description, and then the ability to upload the image representing that item.
Then post to the db the item_no & description and upload the image using the item_no as the image name to a directory on the server. Function would have a variable to define the upload folder.
Please email me if you can do this with a price and any other information.
Thanks
joey@web56.net
|
|
|
 |
danthepcman
|
| Posted: 05/20/2003, 12:59 PM |
|
This is a pretty simple thing to do in PHP, but if you are working in something else it would too much trouble to try and convert everything over.
|
|
|
 |
Sudhi
|
| Posted: 05/20/2003, 1:00 PM |
|
Refer to this article - it is quite simple and has step by step instructions. Albeit the example is for FrontPage, I have used the exact same process with CCS.
http://office.microsoft.com/assistance/2002/articles/fpDispImgDb2.aspx
|
|
|
 |
JoeMann
|
| Posted: 05/22/2003, 6:21 PM |
|
Sudhi
Not sure what you are showing me here... nothing related to question http://office.microsoft.com/assistance/2002/articles/fpDispImgDb2.aspx
danthepcman
please contact me with pricing we are using PHP, thanks
joey@web56.net
|
|
|
 |
RipCurl
|
| Posted: 05/22/2003, 6:54 PM |
|
Main page = itemlist (would be where your grid displays all your items in the DB) insert link would link to the following:
Create your form to "add a new record" . Only included the fields that are text . Not too sure how you're handling your database, but for me, I made the item_no an autoincrement field. So the "add new record form" in your case would only need the Description field. Make sure that your item_no is a hidden field and its "transfered" . In your AFTER INSERT event of your record form add :
$last = mysql_insert_id ();
$sParams .= $last;
( name this page add_record )
Create a new page called add_recordpic . Create a record form that will take the transfer of the item_no variable ( from your add_record page ). Display what you want . For preference, just to be sure the image shows, show the image filed as well (ie description , image ). If the transfer was correct, you should see your newly added "item" with nothing in the "image" field. For me, since I wanted something shown, I designated a temp image to show (Be sure that your image field in your DB is NULL):
On that record, in your BEFORE SHOW event:
if ($fldimage!=null) {
$tmpfile = "images/yourimagedir/".$fldpimage;
$fldimage = "<img src=$tmpfile>";
}
else {
$fldimage="<img src=\"images/yourimagedir/substitued.gif\">";
}
In the Header/FOOTER section of that form (put in footer )
<font class="DataFONT"><FORM ENCTYPE="multipart/form-data" ACTION="add_recordpic_upload.php" METHOD=POST>
Change Image? <INPUT NAME="myfile" TYPE="file">
<INPUT TYPE="hidden" NAME="item_no" VALUE="{item_no}">
<INPUT TYPE="submit" VALUE="Attach File">
</FORM></font>
Now create a page called add_recordpic_upload
In the OPEN EVENTS of that page :
//The file to be uploaded
$tmpfile = "images/emps/".$myfile_name;
if(!file_exists($tmpfile)) {
move_uploaded_file($_FILES['myfile']['tmp_name'], $tmpfile);
echo "<font class=\"DataFONT\">File Uploaded<p>Back to <a href=\"itemlist.php\">Item List</a></font>";
} else {
unlink($tmpfile);
move_uploaded_file($_FILES['myfile']['tmp_name'], $tmpfile);
echo "<font class=\"DataFONT\">File Uploaded<p>Back to <a href=\"itemlist.php\">Item List</a></font>";
}
//Update the database table for the new record
$uSQL = "update TABLE set image='$myfile_name' where item_no=".get_param("item_no");
$db->query($uSQL);
You will have to change it to your settings/ preferences, but this is a down a dirty way of getting it work, especially cross platform (ie uploading from WIn machine to linux server)
|
|
|
 |
RipCurl
|
| Posted: 05/22/2003, 7:13 PM |
|
Forgot to say that the add_record.php page should have the Form ACtion of going to add_recordpic.php page
|
|
|
 |
Sebastian Pfohl
|
| Posted: 05/25/2003, 4:34 AM |
|
I have seen some Questions regarding the upload functions for CodeCharge. I have found a solution that will also work with SAFE MODE=ON in the php.ini. At this time the tutorial is only available in german language at my Website under: http://www.ihc-computerclub.de/artikel/artikel.php?artikel_id=18&
Anyone can use this little tutorial for free, but please, when you use it on your own site, make a little link to me 
Since today, there is another PHP/CodeCharge Tutorial online: Autogenerating Thumbnails within PHP: http://www.ihc-computerclub.de/artikel/artikel.php?artikel_id=21&
|
|
|
 |
|