473,769 Members | 7,097 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

move_uploaded_f ile lose variables

Hi all,

the following easy script correctly insert a record in the DB but is
not moving the images (Logo and Foto) to the server /foto folder.

can't understand why 'cause the script is easy and correct and i guess
it loses the $file_temp var (actually the printout of $file_temp0
return nothing)

i even tryed to write it repeating the parameters i/o using variables
but no results.

Anyone can help ?

Many thanks in advance

Nik

-----------------------------------

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1"))
{

//// set variables
$file_temp0=($_ FILES['Logo']['tmp_name']);
$file_temp1=($_ FILES['Foto']['tmp_name']);

//folder of the image on the server
$percorso="foto/";
$nuovo_nome0=$p ercorso.$_POST['Logo'];
$nuovo_nome1=$p ercorso.$_POST['Foto'];

$insertSQL = sprintf("INSERT INTO marcalinea (ID_MarcaLinea, Marca_,
LineaProdotto_, Logo, Foto, Descrizione, Pdf_) VALUES (%s, %s, %s, %s,
%s, %s, %s)",
GetSQLValueStri ng($_POST['ID_MarcaLinea'],
"int"),
GetSQLValueStri ng($_POST['Marca_'], "int"),
GetSQLValueStri ng($_POST['LineaProdotto_ '],
"int"),
GetSQLValueStri ng($nuovo_nome0 , "text"),
GetSQLValueStri ng($nuovo_nome1 , "text"),
GetSQLValueStri ng($_POST['Descrizione'],
"text"),
GetSQLValueStri ng($_POST['Pdf_'], "int"));

//print ($file_temp0); // return nothings
//print ($nuovo_nome0); // returns correctly /foto/img_name
mysql_select_db ($database_Conn _Bianchi, $Conn_Bianchi);
$Result1 = mysql_query($in sertSQL, $Conn_Bianchi) or
die(mysql_error ());

////Everything ok 'till here; the following does't works:

######### upload image########

move_uploaded_f ile($file_temp0 , $nuovo_nome0);
move_uploaded_f ile($_FILES["Foto"]["tmp_name"],"foto/" .
$_FILES["Foto"]["name"]);

############### ############### #
$insertGoTo = "view.php";
etc...
Nov 23 '07 #1
7 2085
Is the directory the system is writing the file to set with the
correct permissions?

On Nov 23, 10:37 am, nicemot...@gmai l.com wrote:
Hi all,

the following easy script correctly insert a record in the DB but is
not moving the images (Logo and Foto) to the server /foto folder.

can't understand why 'cause the script is easy and correct and i guess
it loses the $file_temp var (actually the printout of $file_temp0
return nothing)

i even tryed to write it repeating the parameters i/o using variables
but no results.

Anyone can help ?

Many thanks in advance

Nik

-----------------------------------

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1"))
{

//// set variables
$file_temp0=($_ FILES['Logo']['tmp_name']);
$file_temp1=($_ FILES['Foto']['tmp_name']);

//folder of the image on the server
$percorso="foto/";

$nuovo_nome0=$p ercorso.$_POST['Logo'];
$nuovo_nome1=$p ercorso.$_POST['Foto'];

$insertSQL = sprintf("INSERT INTO marcalinea (ID_MarcaLinea, Marca_,
LineaProdotto_, Logo, Foto, Descrizione, Pdf_) VALUES (%s, %s, %s, %s,
%s, %s, %s)",
GetSQLValueStri ng($_POST['ID_MarcaLinea'],
"int"),
GetSQLValueStri ng($_POST['Marca_'], "int"),
GetSQLValueStri ng($_POST['LineaProdotto_ '],
"int"),
GetSQLValueStri ng($nuovo_nome0 , "text"),
GetSQLValueStri ng($nuovo_nome1 , "text"),
GetSQLValueStri ng($_POST['Descrizione'],
"text"),
GetSQLValueStri ng($_POST['Pdf_'], "int"));

//print ($file_temp0); // return nothings
//print ($nuovo_nome0); // returns correctly /foto/img_name

mysql_select_db ($database_Conn _Bianchi, $Conn_Bianchi);
$Result1 = mysql_query($in sertSQL, $Conn_Bianchi) or
die(mysql_error ());

////Everything ok 'till here; the following does't works:

######### upload image########

move_uploaded_f ile($file_temp0 , $nuovo_nome0);
move_uploaded_f ile($_FILES["Foto"]["tmp_name"],"foto/" .
$_FILES["Foto"]["name"]);

############### ############### #

$insertGoTo = "view.php";
etc...

Nov 23 '07 #2
On 23 Nov, 17:46, Acrobatic <jbn...@gmail.c omwrote:
Is the directory the system is writing the file to set with the
correct permissions?

On Nov 23, 10:37 am, nicemot...@gmai l.com wrote:
Hi all,
the following easy script correctly insert a record in the DB but is
not moving the images (Logo and Foto) to the server /foto folder.
can't understand why 'cause the script is easy and correct and i guess
it loses the $file_temp var (actually the printout of $file_temp0
return nothing)
i even tryed to write it repeating the parameters i/o using variables
but no results.
Anyone can help ?
Many thanks in advance
Nik
-----------------------------------
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1"))
{
//// set variables
$file_temp0=($_ FILES['Logo']['tmp_name']);
$file_temp1=($_ FILES['Foto']['tmp_name']);
//folder of the image on the server
$percorso="foto/";
$nuovo_nome0=$p ercorso.$_POST['Logo'];
$nuovo_nome1=$p ercorso.$_POST['Foto'];
$insertSQL = sprintf("INSERT INTO marcalinea (ID_MarcaLinea, Marca_,
LineaProdotto_, Logo, Foto, Descrizione, Pdf_) VALUES (%s, %s, %s, %s,
%s, %s, %s)",
GetSQLValueStri ng($_POST['ID_MarcaLinea'],
"int"),
GetSQLValueStri ng($_POST['Marca_'], "int"),
GetSQLValueStri ng($_POST['LineaProdotto_ '],
"int"),
GetSQLValueStri ng($nuovo_nome0 , "text"),
GetSQLValueStri ng($nuovo_nome1 , "text"),
GetSQLValueStri ng($_POST['Descrizione'],
"text"),
GetSQLValueStri ng($_POST['Pdf_'], "int"));
//print ($file_temp0); // return nothings
//print ($nuovo_nome0); // returns correctly /foto/img_name
mysql_select_db ($database_Conn _Bianchi, $Conn_Bianchi);
$Result1 = mysql_query($in sertSQL, $Conn_Bianchi) or
die(mysql_error ());
////Everything ok 'till here; the following does't works:
######### upload image########
move_uploaded_f ile($file_temp0 , $nuovo_nome0);
move_uploaded_f ile($_FILES["Foto"]["tmp_name"],"foto/" .
$_FILES["Foto"]["name"]);
############### ############### #
$insertGoTo = "view.php";
etc...
hi acrobatic! - many thanks for your ppt reply

yes, it is; all permission are ok and the script to upload the files
separately works correctly.

The problem rises when i insert the record and upload the image on the
same page...i'm afraid the var are lost somewhere
Nov 23 '07 #3
On Fri, 23 Nov 2007 17:37:28 +0100, <ni********@gma il.comwrote:
Hi all,

the following easy script correctly insert a record in the DB but is
not moving the images (Logo and Foto) to the server /foto folder.

can't understand why 'cause the script is easy and correct and i guess
it loses the $file_temp var (actually the printout of $file_temp0
return nothing)

i even tryed to write it repeating the parameters i/o using variables
but no results.
Examine $_FILES['indexname']['error']
http://nl2.php.net/manual/en/feature...oad.errors.php
--
Rik Wasmus
Nov 23 '07 #4
On 23 Nov, 17:59, "Rik Wasmus" <luiheidsgoe... @hotmail.comwro te:
On Fri, 23 Nov 2007 17:37:28 +0100, <nicemot...@gma il.comwrote:
Hi all,
the following easy script correctly insert a record in the DB but is
not moving the images (Logo and Foto) to the server /foto folder.
can't understand why 'cause the script is easy and correct and i guess
it loses the $file_temp var (actually the printout of $file_temp0
return nothing)
i even tryed to write it repeating the parameters i/o using variables
but no results.

Examine $_FILES['indexname']['error']http://nl2.php.net/manual/en/features.file-upload.errors.p hp
--
Rik Wasmus
Many thanks Rik,

written like this returns nothing , the record is inserted but the
pics are not uploaded.

.......... GetSQLValueStri ng($nuovo_nome1 , "text"),
GetSQLValueStri ng($_POST['Descrizione'],
"text"),
GetSQLValueStri ng($_POST['Pdf_'], "int"));
$errore=($_FILE S['Logo']['tmp_name']['error']);

print($errore);
mysql_select_db ($database..... ......
However i'm afraid (almost sure) i'm not using "" $_FILES['indexname']
['error'] "" correctly
Nov 23 '07 #5
On Fri, 23 Nov 2007 18:26:55 +0100, <ni********@gma il.comwrote:
On 23 Nov, 17:59, "Rik Wasmus" <luiheidsgoe... @hotmail.comwro te:
>On Fri, 23 Nov 2007 17:37:28 +0100, <nicemot...@gma il.comwrote:
the following easy script correctly insert a record in the DB but is
not moving the images (Logo and Foto) to the server /foto folder.
can't understand why 'cause the script is easy and correct and i guess
it loses the $file_temp var (actually the printout of $file_temp0
return nothing)
i even tryed to write it repeating the parameters i/o using variables
but no results.

Examine
$_FILES['indexname']['error']http://nl2.php.net/manual/en/features.file-upload.errors.p hp
written like this returns nothing , the record is inserted but the
pics are not uploaded.

......... GetSQLValueStri ng($nuovo_nome1 , "text"),
GetSQLValueStri ng($_POST['Descrizione'],
"text"),
GetSQLValueStri ng($_POST['Pdf_'], "int"));
$errore=($_FILE S['Logo']['tmp_name']['error']);

print($errore);

However i'm afraid (almost sure) i'm not using "" $_FILES['indexname']
['error'] "" correctly
What does var_dump($_FILE S); tell you? 'Logo' might not even be there.....
--
Rik Wasmus
Nov 23 '07 #6
On 23 Nov, 18:31, "Rik Wasmus" <luiheidsgoe... @hotmail.comwro te:
On Fri, 23 Nov 2007 18:26:55 +0100, <nicemot...@gma il.comwrote:
On 23 Nov, 17:59, "Rik Wasmus" <luiheidsgoe... @hotmail.comwro te:
On Fri, 23 Nov 2007 17:37:28 +0100, <nicemot...@gma il.comwrote:
the following easy script correctly insert a record in the DB but is
not moving the images (Logo and Foto) to the server /foto folder.
can't understand why 'cause the script is easy and correct and i guess
it loses the $file_temp var (actually the printout of $file_temp0
return nothing)
i even tryed to write it repeating the parameters i/o using variables
but no results.
Examine
$_FILES['indexname']['error']http://nl2.php.net/manual/en/features.file-upload.errors.p hp
written like this returns nothing , the record is inserted but the
pics are not uploaded.
......... GetSQLValueStri ng($nuovo_nome1 , "text"),
GetSQLValueStri ng($_POST['Descrizione'],
"text"),
GetSQLValueStri ng($_POST['Pdf_'], "int"));
$errore=($_FILE S['Logo']['tmp_name']['error']);
print($errore);
However i'm afraid (almost sure) i'm not using "" $_FILES['indexname']
['error'] "" correctly

What does var_dump($_FILE S); tell you? 'Logo' might not even be there....
--
Rik Wasmus
Dear Rik,

tks for yr debug suggestions, i'll study and revert

What's strange is that print ($nuovo_nome0); returns correctly /foto/
img_name

...is the $file_temp0=($_ FILES['Logo']['tmp_name']) that does't works

Btw, debug and revert

Ciao by now (dinner time !) eand thanks a lot
Nov 23 '07 #7
Can we see the script/form that you specify the upload file with?
Maybe you don't have the ENCTYPE set correctly. You'll need to set
enctype to "multipart/form-data":

ie:

<form action="..." method="post" enctype="multip art/form-data"
name="...">

etc

</form>
On Nov 23, 10:37 am, nicemot...@gmai l.com wrote:
Hi all,

the following easy script correctly insert a record in the DB but is
not moving the images (Logo and Foto) to the server /foto folder.

can't understand why 'cause the script is easy and correct and i guess
it loses the $file_temp var (actually the printout of $file_temp0
return nothing)

i even tryed to write it repeating the parameters i/o using variables
but no results.

Anyone can help ?

Many thanks in advance

Nik

-----------------------------------

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1"))
{

//// set variables
$file_temp0=($_ FILES['Logo']['tmp_name']);
$file_temp1=($_ FILES['Foto']['tmp_name']);

//folder of the image on the server
$percorso="foto/";

$nuovo_nome0=$p ercorso.$_POST['Logo'];
$nuovo_nome1=$p ercorso.$_POST['Foto'];

$insertSQL = sprintf("INSERT INTO marcalinea (ID_MarcaLinea, Marca_,
LineaProdotto_, Logo, Foto, Descrizione, Pdf_) VALUES (%s, %s, %s, %s,
%s, %s, %s)",
GetSQLValueStri ng($_POST['ID_MarcaLinea'],
"int"),
GetSQLValueStri ng($_POST['Marca_'], "int"),
GetSQLValueStri ng($_POST['LineaProdotto_ '],
"int"),
GetSQLValueStri ng($nuovo_nome0 , "text"),
GetSQLValueStri ng($nuovo_nome1 , "text"),
GetSQLValueStri ng($_POST['Descrizione'],
"text"),
GetSQLValueStri ng($_POST['Pdf_'], "int"));

//print ($file_temp0); // return nothings
//print ($nuovo_nome0); // returns correctly /foto/img_name

mysql_select_db ($database_Conn _Bianchi, $Conn_Bianchi);
$Result1 = mysql_query($in sertSQL, $Conn_Bianchi) or
die(mysql_error ());

////Everything ok 'till here; the following does't works:

######### upload image########

move_uploaded_f ile($file_temp0 , $nuovo_nome0);
move_uploaded_f ile($_FILES["Foto"]["tmp_name"],"foto/" .
$_FILES["Foto"]["name"]);

############### ############### #

$insertGoTo = "view.php";
etc...
Nov 23 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7648
by: neo002244 | last post by:
The move_uploaded_file() function is very quirky. I want to allow users to upload images to the Web site. Here is the code: if(!move_uploaded_file($_FILES, $imagefile)) { die("Could not move file: ".$_FILES." -> $imagefile"); } else { enter record into database...
1
3017
by: Felix Natter | last post by:
hi, I would like to upload a file (via a form), then read that (temporary) file and write the contents into a database. The first problem is that open_basedir=/home/CUSTOMER so I can't just read it from /tmp. That's why I used move_uploaded_file() to move the file to /home/CUSTOMER/DOMAIN/tmp/FILENAME: ======================================================
1
10683
by: sa | last post by:
Trying to upload a file using win xp/iis/php. I've given full access to all accounts trying to get this to work? Yet I'm still getting read errors. Simplified the script below to the bare minimum. simpleupload.php <form enctype="multipart/form-data" action="upload.php" method="post"> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="200000"/>
6
3376
by: Stijn Goris | last post by:
HI all, I have created a script that allows a user to upload a picture. I have an IIS server runing on my own pc but the actual site runs an Apache server. The upload script worked perfectly on my IIS but refuses to work on the Apache. All I know is that the script stops working at move_uploaded_file() function. The warnings echo'ed are: Warning: move_uploaded_file(images/nieuws/TIDEEY%7E1.jpg): failed to open
2
16300
by: Brian | last post by:
Hi I am moving a site to a new server, I have been testing it and one of the pages uses move_uploaded_file, but I get a Permission denied. The directory I am moving it to is chomd of 755, if I change it to 777 it does upload but the owner is www-data, but I then can't download it using a FTP client (which I have to do) as it's the wrong owner, so I have to leave the chomd as 755, but
10
1715
by: Michael SL | last post by:
I have been using session variables in my asp.net application without any trouble. But now in a very specific case I am losing them. On one of my pages I set a date in a dropdownlist (autopostback=false) and then click a "Build" button which builds a report. Most of the time there is no problem. But sometimes the following happens. I step through the code no problem, the session variables do not change. But, when examined after the the...
8
6846
by: Simone Chiaretta | last post by:
I've a very strange behaveour related to a website we built: from times to times, something should happen on the server, and all static variables inside the web application, both defined inside aspx code-behind and in business logic (C# classes used by the aspx) lose their value. I cannot reproduce this on our development server, so I cannot understand what the cause of all this is. We are using asp.net 1.1 with IIS6 on win2003.
1
4238
by: comp.lang.php | last post by:
Consider my code: if ($this->isSuccessful && is_file($_FILES)) { // STEP 6: MOVE RESUME TO DIRECTORY $uuid = $this->sfug->getUUID(); if (!$uuid) $this->sfug->setUUID(); $uuid = $this->sfug->getUUID();
5
3373
by: bill | last post by:
I can validate that the file uploaded because is_uploaded_file() returns true. --------- if (is_uploaded_file($_FILES)) { echo "File ". $_FILES ." uploaded successfully.<br />"; } ------------------------ When I try to move the file using move_uploaded_file it fails. --------------
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10214
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10048
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9996
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7410
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3963
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.