Jump to content

Archived

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

Deftone

Photo upload

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]

Share this post


Link to post
Share on other sites
By the way this is the last script that don't work.
The other I get fixed with help from this forum

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
Hi Ken,

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

Share this post


Link to post
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 ?

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

×

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.