Jump to content


Photo

Photo upload


  • Please log in to reply
12 replies to this topic

#1 Deftone

Deftone
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 27 July 2006 - 07:47 AM

Hi,

Again I'm going to ask foryor help.  :'(
I have script that give me the possibility to upload the foto's to my gallery.
Since PHP 5 this script is not working.
When I fill all the info the fields turns blank but nothing happens
Can you help me again ?

<?php
include ('_mySQL.php');
if ($toevoegen == "ja") {

if ($pwd == "$pass") {

$database_server = mysql_connect("$host","$user","$pass");
mysql_select_db("$database", $database_server);
mysql_connect("$host","$user","$pass");
mysql_select_db("$database");
$query = "SELECT id FROM plaatjes ORDER BY id DESC LIMIT 0, 1";
//Select
$resultaat = mysql_query($query) or die ("Het ophalen van de gegevens is mislukt.");
while ($record = mysql_fetch_object($resultaat)) {

$beschikbaar = $record->id + 1;
}




$map = "../uploads/";
$mapa = "../fotos/";
//uploaden
// Bestands naam opvragen
$bestand2 = explode("\\", $bestand_name);
$laatste = count($bestand2) - 1;
$bestand2 = "$bestand2[$laatste]"; 

//$bestand2 = "$beschikbaar.jpg";

$aaa = "$beschikbaar.jpg";


// Save file 
copy($bestand, "$map$bestand2"); 
print ("De afbeelding is met succes geupload.<br>");

//Rename
rename("$map$bestand2", "$mapa$aaa");
echo "De afbeelding is met succes hernoemd.<br><br>";











$bestand = "$thumbnail";

$map = "../uploads/";
$mapa = "../thumbnails/";
//uploaden
// Bestands naam opvragen
$bestand2 = explode("\\", $bestand_name);
$laatste = count($bestand2) - 1;
$bestand2 = "$bestand2[$laatste]"; 

//$bestand2 = "$beschikbaar.jpg";

$aaa = "$beschikbaar.jpg";


// Save file
copy($bestand, "$map$bestand2"); 
print ("De thumbnail is met succes geupload.<br>");

//rename
rename("$map$bestand2", "$mapa$aaa");
echo "De thumbnail is met succes geupload.<br><br>";


#2 Deftone

Deftone
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 27 July 2006 - 05:24 PM

No one  :'(

#3 spfoonnewb

spfoonnewb
  • Members
  • PipPipPip
  • Advanced Member
  • 276 posts

Posted 27 July 2006 - 07:03 PM

Do you need PHP 5, if not why not just revert back to version 4?

#4 Deftone

Deftone
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 27 July 2006 - 07:22 PM

Yeah good question.
Becouse My new host only have PHP5  ;)

#5 Deftone

Deftone
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 27 July 2006 - 10:14 PM

By the way this is the last script that don't work.
The other I get fixed with help from this forum

#6 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 27 July 2006 - 11:45 PM

When your host upgraded to version 5 they finally bit the bullet and disabled register_globals (http://www.php.net/register_globals), like they should have a few years ago when the default changed from enabled to disabled. To fix your problems, you need to start using the super global arrays $_POST, $_FILES, etc.

Read the section in the manual.

Ken

#7 Deftone

Deftone
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 30 July 2006 - 06:08 AM

Hi Ken,

I try to make it work but it did not worked.
I'm to new in this world to fix it.

#8 Deftone

Deftone
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 01 August 2006 - 10:29 AM

Ok maybe I'm a littlebit futher.
Now when I try to upload something I get this error:
Warning: rename(../uploads/,../fotos/317.jpg) [function.rename]: Permission denied in /home/knr11315/domains/kimi-raikkonen.nl/public_html/plaatjes/toevoegen.php on line 40
The line 40 in the php script is like this:
rename("$map$bestand2", "$mapa$aaa");
What is wrong with this one ?

#9 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 01 August 2006 - 03:15 PM

Just seems that the permissions on the script that needs to rename the file is incorrect.  Or that the directory where the file is to be renamed does not have the correct permissions either...



#10 Deftone

Deftone
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 01 August 2006 - 05:32 PM

I chmod throug SSH all the files to 777
So I dont think it's the permission issue
I also call the webhost but they said that it's the script that couses the problem

#11 spfoonnewb

spfoonnewb
  • Members
  • PipPipPip
  • Advanced Member
  • 276 posts

Posted 02 August 2006 - 06:06 PM

Although my problem was on a VPS I had an issue with ownership,

I had to run chown & chngrp commands on shell, and to put the directories at 777

Since I dont know if your on shared hosting or what? I cant help too much.

Is PHP_Safe_Mode On? I also had a problem with that, and had to turn it off.

#12 Deftone

Deftone
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 02 August 2006 - 08:31 PM

Dear,

I'm on the shared hosting.
I think that's the problem is that I'm the ftp user and I don't have permission  to rename files.
But how to change the user? Iknow that php knows two users php and ftp
I chmod the files already to 777 but it's not helping.


#13 spfoonnewb

spfoonnewb
  • Members
  • PipPipPip
  • Advanced Member
  • 276 posts

Posted 03 August 2006 - 02:31 AM

You can use: (In Shell)

chgrp -Rv GROUPNAME /root/path/file.php

chown -Rv USERNAME /root/path/file.php

You'll need to know what the username and group are to do that though, so id ask you host.

Some ftp/sftp programs will tell you what they are by right-clicking a file you can use and hitting properties, I know WinSCP does that.

Make sure you right click a file that you have rights to rename/edit.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users