Koozali.org: home of the SME Server
Legacy Forums => General Discussion (Legacy) => Topic started by: xxlm on October 18, 2004, 12:34:01 AM
-
Hello.
Ok I get a problem.
I can't read file (jpg) when using sme 6.01.
I made a script and test it locally (winxp) on my wamp server (apache, php 4.3, mysql4) and it works fine.
But asap I'm uploading it on my server, the line below when echo don't display anything (my $data var is empty)... WHY?
$data = addslashes(fread(fopen($file['tmp_name'], 'rb'), $file['size']));
When I'm doing a return of file_exist($file['tmp_name']) i get true. So the file is ok and the path too.
Any Idea?
I'm using on my sme php 4.1.2 and mysql 4.20.
Thx a lot. :)
-
If you are uploading the files using ftp, be sure your ftp-client is in binary mode, if in ascii mode, the files might get corrupted.
-
On linux all is in binary mode no?
In fact user is uploading a file via a form and I'm reading it to put the data into db.
Was working everywhere except on my sme...
here is a part (begining until bug) of the script
//GETTING VAR SENT
$referaction = $_POST['referaction'];
$id = $_POST['ID'];
$action = $_POST['action'];
$reference = addslashes($_POST['frmREFERENCE']);
$name = addslashes($_POST['frmNAME']);
$price = addslashes($_POST['frmPRICE']);
$idcat = addslashes($_POST['frmIDCAT']);
$file = $_FILES['file'];
/* code we don't need was deleted here like metatag, includes, ...*/
$Conn = myconnect();
if ($referaction == "modify") {
$myProducts = mysql_query("SELECT * FROM ".$C_TBL_PHOTOS." WHERE ID='".$id."'", $Conn);
$myproduct = mysql_fetch_array($myProducts);
}
if($action == "send" || $action == "modify") {
echo "<center>Please wait while sending data ...";
if($file['name'] != "" && is_uploaded_file($file['tmp_name']) ) {
$size = filesize($file['tmp_name']);
$data = addslashes(fread(fopen($file['tmp_name'], "rb"), $size));
...
After the line $data = addslashees( ... )
if I do an echo I get nothing on my sme.
On my wamp server it's working great.
So any idea?
Thx a LOT