TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 04-02-2008, 12:29 PM   #1 (permalink)
The Contributor
Newcomer 
 
Join Date: Jan 2008
Posts: 27
Thanks: 1
lesP is on a distinguished road
Default Changing imagesize while uploading.

Hi Guys!

I have done a uploading script, but I want to do, so when I upload an image the image should be stored in 3 different sizes. That means 3 different pictures. What is the easiest way to do that? Here is my upload-script:

PHP Code:
$filename 'billeder/' basename($_FILES['file']['name']);


        if (
move_uploaded_file($_FILES['file']['tmp_name'], $filename)) {
            echo 
"File is valid, and was successfully uploaded.";
        } else {
            echo 
'DEBUG: Fra: ' $_FILES['file']['tmp_name'] . ' til ' $filename '<br>';
            echo 
"Possible file upload attack!";
        }    

        
$sql "INSERT INTO smykker (smykkenavn, beskrivelse, pris, varenr, billede, kategori, underkategori, leveringstid)
            VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')"
;
        
$sql sprintf($sql,
            
mysql_real_escape_string($_POST['smykkenavn']),
            
mysql_real_escape_string($_POST['beskrivelse']),
            
mysql_real_escape_string($_POST['pris']),
            
mysql_real_escape_string($_POST['varenr']),
            
mysql_real_escape_string($filename),
            
mysql_real_escape_string($_POST['kategori']),
            
mysql_real_escape_string($_POST['underkategori']),
            
mysql_real_escape_string($_POST['leveringstid'])
            );

        
$res mysql_query($sql) or die(mysql_error());
        echo 
"Done<br>Klik <a href='upload.php'>her</a> for at gå tilbage."
lesP is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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


All times are GMT. The time now is 03:38 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design