CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Please Help w/Uploading An Image (PHP)

Print topic Send  topic

Author Message
DeWebDude
Posted: 05/23/2003, 11:51 PM

OK maybe my brain is missing a few cells from drinking way too much coca cola, but I am not having much luck with several examples of upload functions.
Here is what I would like to do, and hopefully someone out there can spare me from pulling more of my hair out of my head.

Using CC

I would like my item_record form to store the fields for the item table, as well as upload an image to a folder on the server that represents that item (hopefully from one submit button).

I have read through about 5 examples, and tried a couple of them out seemingly always missing something on my side.

I would just assume call a module for the core php stuff to keep everything cleaner ( I hope ).

If you could really spell out exact details, like what form, what form or page event etc that would be great. I really want to understand what the heck I am doing wrong and of course get the upload working.

So in review Form Prompts for:
Item Number, Description, (other fields), file information ( browse button )

After point and click of file name, the user would click submit once, and the process would begin. Also I would like the file name of the uploaded image to be the same as the item number.

Maybe if you have a CC file you could simply email it to me, and I could see how you did it, once I understand it and have it working, I beleive I can figure it out and move on to the next phase of my project..


thanks....
my email isDeWebDude@web56.net
DeWebDude
Posted: 05/27/2003, 5:26 AM

Sorry to post again guys, but no luck on an answer...

Thanks
Tomasz
Posted: 05/27/2003, 5:52 AM

it's hard to help you without details what is wrong at your side. i have no problem using 'php upload' examples which you can found at gotocode. just use one of them and change working example.

e.g. below you can find simply code which i use to change name of uploaded file to item id. it stores extension in var, changes name and then adds extension again. after loading file db is updated with its name.

// --------------------------------
// Check if file is uploaded
// --------------------------------
if ($i_pic_name)
{
$extension=substr($i_pic_name, -4, 4);
$i_pic_name = $i_cat_no;
$i_pic_name .= $extension;

$tmpfile = "images/items/".$i_pic_name;

// Upload file
if (!file_exists($tmpfile))
{ copy($i_pic,$tmpfile); }
else
{ unlink($tmpfile);
copy($i_pic,$tmpfile); }
chmod ("$tmpfile", 0755);

// write file name to db
$uSQL = "update items set i_image = '$i_pic_name' where i_id='$item_id'";
$db->query($uSQL);
}

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.