Jump to content

Photo upload


Deftone

Recommended Posts

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 ?

[code]<?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>";
[/code]
Link to comment
https://forums.phpfreaks.com/topic/15784-photo-upload/
Share on other sites

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
Link to comment
https://forums.phpfreaks.com/topic/15784-photo-upload/#findComment-64889
Share on other sites

Ok maybe I'm a littlebit futher.
Now when I try to upload something I get this error:
[code]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
[/code]
The line 40 in the php script is like this:
[code]rename("$map$bestand2", "$mapa$aaa");[/code]
What is wrong with this one ?
Link to comment
https://forums.phpfreaks.com/topic/15784-photo-upload/#findComment-66941
Share on other sites

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.
Link to comment
https://forums.phpfreaks.com/topic/15784-photo-upload/#findComment-67996
Share on other sites

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.
Link to comment
https://forums.phpfreaks.com/topic/15784-photo-upload/#findComment-68281
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.