Current location: Hot Scripts Forums » Programming Languages » PHP » Image Upload


Image Upload

Reply
  #1 (permalink)  
Old 01-25-04, 08:42 AM
canman2004 canman2004 is offline
New Member
 
Join Date: Jan 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Image Upload

Dear all

I have a control panel for adding products to my website which is done in PHP, the control panel pulls the rows and tables and displays them directly on the page for editing. At the moment I have to FTP an image and then tell the control panel where the image is held on the server.

Can anyone help me put in a browse image button for dicrect upload on the control panel.

Thanks

Can
Reply With Quote
  #2 (permalink)  
Old 01-25-04, 09:21 PM
blaw's Avatar
blaw blaw is offline
Junior Code Guru
 
Join Date: Dec 2003
Location: Vancouver, BC, Canada
Posts: 550
Thanks: 0
Thanked 0 Times in 0 Posts
Hi there,

Try reading this and its subsequent document:

PHP: Handling file uploads
http://ca.php.net/features.file-upload

It tells you A-to-Z of file uploads with PHP.

Good luck.
__________________
Blavv =|
Reply With Quote
  #3 (permalink)  
Old 01-26-04, 08:30 AM
jrock jrock is offline
New Member
 
Join Date: Jan 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Talking upload_img.php

<?
include "./config.php";
session_start();
?>
<?php

$path = "./files/";
$max_size = 3000000;

if (!isset($HTTP_POST_FILES['userfile'])) exit;

if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) {

if ($HTTP_POST_FILES['userfile']['size']>$max_size) { echo "<center>Soubor je příliš velký!<br></center>\n"; exit; }

if (file_exists($path . $HTTP_POST_FILES['userfile']['name'])) { echo "<center>Soubor s tímto jménem už existuje!<br></center>\n"; exit; }

$res = copy($HTTP_POST_FILES['userfile']['tmp_name'], $path .
$HTTP_POST_FILES['userfile']['name']);


if (!$res) { echo "<center>Chyba při ukládání na server!</center><br>\n"; exit; } else { echo "<center>Soubor uložen!<br><br></center>\n"; }

echo "<center>Název: ".$HTTP_POST_FILES['userfile']['name']."</center>\n";
echo "<center>Velikost: ".$HTTP_POST_FILES['userfile']['size']." bytes</center>\n";
echo "<center>Typ: ".$HTTP_POST_FILES['userfile']['type']."</center>\n\n";
echo "<html><head><center>...<a href=main.php>pokra&#x010D;ovat</a></center></html>";
} else { echo "<center>Špatný formát souboru!<br></center>\n"; exit; }

?>
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Image File Upload Script Millz PHP 6 12-30-03 10:37 AM
Help with my upload script TheMetsAreBad PHP 2 12-04-03 06:10 PM
Basic image upload and data to mysql mdhall Script Requests 3 11-05-03 05:00 PM
Kamk.com Free Image Upload Rbad750 Website Reviews 6 10-18-03 01:43 AM
Kamk.com Image Upload Rbad750 General Advertisements 0 09-28-03 12:31 AM


All times are GMT -5. The time now is 07:59 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.