Upload php error: No such file or directory
Discuss coding issues, and scripts related to PHP and MySQL.
-
JanMolendijk
- Posts:282
- Location:Holland Rotterdam
Upload php error: No such file or directory
Well here i`m again... I wanna use this script
https://coursesweb.net/php-mysql/simple- ... -script_s2
Now i try with an id (int) into this script
Code: Select all
<?php
include('connection.php');
$id = (int) $_GET['id'];
$sql=mysqli_query($conn,"SELECT * FROM `user` WHERE id='" . $id . "' ");
$users=mysqli_fetch_assoc($sql);
?>
Now i try into your code this
Code: Select all
$uploadpath = 'images/$users[email]/'; // directory to store the uploaded files
$max_size = 2000; // maximum file size, in KiloBytes
$alwidth = 1900; // maximum allowed width, in pixels
$alheight = 1800; // maximum allowed height, in pixels
$allowtype = array('bmp', 'gif', 'jpg', 'jpe', 'png'); // allowed extensions
I getting errors when i use $users[email]
I tried also with
but still getting the same error
Admin
Posts:805
Hello,
Try this code in the upload script:
Code: Select all
$uploadpath ='images/'. $users['email'] .'/'; // directory to store the uploaded files
//if the folder not exists, create it
if(!file_exists($uploadpath)){
if(!mkdir($uploadpath, 0755)) echo 'Unable to create the folder: '. $uploadpath;
}
//the rest of your code..
JanMolendijk
Posts:282
I got one question i try to ad for the upload more extensions like avi or mp3
but when i put this i get the error
Code: Select all
The file: 03.avi not has the allowed extension type.
Code: Select all
$allowtype = array('bmp', 'gif', 'jpg', 'jpe', 'png', 'avi');
Is it posible with this script to ad more extensions ?
Edit:
- Sorry it workt just fine thanks for Suporting.
Similar Topics
- Change the max upload size in XAMPP
PHP - MySQL
First post
Pleassant Marplo, hope all things are okey ?
I have a question, I think I have server problem with uploading maximal upload-file (mb) is to less I...
Last post
Marplo in once thanks for the great suport
- GET_id not working in UnLink (delete file)
PHP - MySQL
First post
I searching for an hour for a solution; unlink seems not to work with GET id
<?php
$id = (int) $_GET ;
echo $_GET ;
$file = fopen( '.$_GET...
Last post
Here is an answer `o god after 2 hours shame on me for this one`
<?php
$file_pointer = $_GET .'.txt';
if (!unlink($file_pointer)) {
echo (...