Raar probleem, uploaden.
Ik heb het volgende script gemaakt:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
include 'config.php';
$target = "images/preview/";
$target = $target . basename( $_FILES['previewe']['name']) ;
$ok=1;
@$uploaded_Name = $_FILES['previewe']['name'];
@$uploaded_Temp = $_FILES['uploaded']['tmp_name'];
$uploadFile = $target.$uploaded_Name ;
$previewe = "http://www.xxx.com/images/preview/".$uploaded_Name ;
@chmod(dirname($target), 0777);
@move_uploaded_file($uploaded_Temp , $uploadFile);
$sql="INSERT INTO template (title, previewe, descr, categorie, freedownload, premiumdownload, cost, author, demo, big, authorlink, featured)
VALUES
('$_POST[title]','$previewe','$_POST[descr]','$_POST[categorie]','$_POST[freedownload]','$_POST[premiumdownload]','$_POST[cost]','$_POST[author]','$_POST[demo]','$_POST[big]','$_POST[authorlink]','$_POST[featured]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Template added!";
mysql_close($con)
?>
include 'config.php';
$target = "images/preview/";
$target = $target . basename( $_FILES['previewe']['name']) ;
$ok=1;
@$uploaded_Name = $_FILES['previewe']['name'];
@$uploaded_Temp = $_FILES['uploaded']['tmp_name'];
$uploadFile = $target.$uploaded_Name ;
$previewe = "http://www.xxx.com/images/preview/".$uploaded_Name ;
@chmod(dirname($target), 0777);
@move_uploaded_file($uploaded_Temp , $uploadFile);
$sql="INSERT INTO template (title, previewe, descr, categorie, freedownload, premiumdownload, cost, author, demo, big, authorlink, featured)
VALUES
('$_POST[title]','$previewe','$_POST[descr]','$_POST[categorie]','$_POST[freedownload]','$_POST[premiumdownload]','$_POST[cost]','$_POST[author]','$_POST[demo]','$_POST[big]','$_POST[authorlink]','$_POST[featured]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Template added!";
mysql_close($con)
?>
Nu het probleem is, met de upload in het begin. ik insert de upload link in men database, dit lukt.
Het rare is dat het script de file zelf niet upload... maar alleen de naam wel in de database zet.
De folder images/preview/ is ook ge CHMOD naar 0777...
ik heb er geen idee van hoe dat komt, jullie wel?
boven je script en haal die @ uit je script, nergens voor nodig!
mvg Joost.
Zet dit: mvg Joost.
Kheb die @s gedelete.
Dit zijn de errors:
Notice: Undefined index: uploaded in /home/template/public_html/inserttemplate2.php on line 11
Warning: chmod() [function.chmod]: Operation not permitted in /home/template/public_html/inserttemplate2.php on line 15
Template added!
mvg Joost.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
include 'config.php';
ini_set('display_errors', 1);
error_reporting(E_ALL | E_STRICT);
$target = "images/preview/";
$target = $target . basename( $_FILES['previewe']['name']) ;
$ok=1;
$uploaded_Name = $_FILES['previewe']['name'];
$uploaded_Temp = $_FILES['previewe']['tmp_name'];
$uploadFile = $target.$uploaded_Name ;
$previewe = "http://wwwxxxcom/images/preview/".$uploaded_Name ;
chmod(dirname($target), 0777);
move_uploaded_file($uploaded_Temp , $uploadFile);
$sql="INSERT INTO template (title, previewe, descr, categorie, freedownload, premiumdownload, cost, author, demo, big, authorlink, featured)
VALUES
('$_POST[title]','$previewe','$_POST[descr]','$_POST[categorie]','$_POST[freedownload]','$_POST[premiumdownload]','$_POST[cost]','$_POST[author]','$_POST[demo]','$_POST[big]','$_POST[authorlink]','$_POST[featured]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Template added!";
mysql_close($con)
?>
include 'config.php';
ini_set('display_errors', 1);
error_reporting(E_ALL | E_STRICT);
$target = "images/preview/";
$target = $target . basename( $_FILES['previewe']['name']) ;
$ok=1;
$uploaded_Name = $_FILES['previewe']['name'];
$uploaded_Temp = $_FILES['previewe']['tmp_name'];
$uploadFile = $target.$uploaded_Name ;
$previewe = "http://wwwxxxcom/images/preview/".$uploaded_Name ;
chmod(dirname($target), 0777);
move_uploaded_file($uploaded_Temp , $uploadFile);
$sql="INSERT INTO template (title, previewe, descr, categorie, freedownload, premiumdownload, cost, author, demo, big, authorlink, featured)
VALUES
('$_POST[title]','$previewe','$_POST[descr]','$_POST[categorie]','$_POST[freedownload]','$_POST[premiumdownload]','$_POST[cost]','$_POST[author]','$_POST[demo]','$_POST[big]','$_POST[authorlink]','$_POST[featured]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Template added!";
mysql_close($con)
?>
Warning: chmod() [function.chmod]: Operation not permitted in /home/template/public_html/inserttemplate2.php on line 15
Template added!
is nu de enige error en het upload nog altijd niet..
Gewijzigd op 01/01/1970 01:00:00 door Jelle Sturm
Je controleert nergens of er iets daadwerkelijk is gebeurd. En haal de @-jes weg en bouw een nette foutafkandeling in.
En het controleren is niet echt nodig... ik weet dat het niet lukt want de file staat niet in de directory.
Het is raar dat het met die naam wel lukt...
Jelle schreef op 24.01.2009 20:36:
En het controleren is niet echt nodig...
In dat geval ben ik weer klaar. Zonder controle blijft het gokken. Wat jij wilt uiteraard.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
include 'config.php';
ini_set('display_errors', 1);
error_reporting(E_ALL | E_STRICT);
$target = "images/preview/";
$ok=1;
$uploaded_Name = $_FILES['previewe']['name'];
$uploaded_Temp = $_FILES['previewe']['tmp_name'];
$previewe = "http://www.xxx.com/images/preview/".$uploaded_Name ;
chmod(dirname($target), 0777);
move_uploaded_file($uploaded_Temp, "$target/$uploaded_Name");
$sql="INSERT INTO template (title, previewe, descr, categorie, freedownload, premiumdownload, cost, author, demo, big, authorlink, featured)
VALUES
('$_POST[title]','$previewe','$_POST[descr]','$_POST[categorie]','$_POST[freedownload]','$_POST[premiumdownload]','$_POST[cost]','$_POST[author]','$_POST[demo]','$_POST[big]','$_POST[authorlink]','$_POST[featured]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Template added!";
mysql_close($con)
?>
include 'config.php';
ini_set('display_errors', 1);
error_reporting(E_ALL | E_STRICT);
$target = "images/preview/";
$ok=1;
$uploaded_Name = $_FILES['previewe']['name'];
$uploaded_Temp = $_FILES['previewe']['tmp_name'];
$previewe = "http://www.xxx.com/images/preview/".$uploaded_Name ;
chmod(dirname($target), 0777);
move_uploaded_file($uploaded_Temp, "$target/$uploaded_Name");
$sql="INSERT INTO template (title, previewe, descr, categorie, freedownload, premiumdownload, cost, author, demo, big, authorlink, featured)
VALUES
('$_POST[title]','$previewe','$_POST[descr]','$_POST[categorie]','$_POST[freedownload]','$_POST[premiumdownload]','$_POST[cost]','$_POST[author]','$_POST[demo]','$_POST[big]','$_POST[authorlink]','$_POST[featured]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Template added!";
mysql_close($con)
?>
Thx SanThe en Joost