|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
In the code below I cannot move uploaded file. I don't know why. The folder
Paper has priviledges rwxrwxrwx. $_POST['Year'] and $_POST['Month'] are valid. Please . Thanks in advance! <?php session_start(); if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['EditionFile']) && isset($_POST['Year']) && isset($_POST['Month'])) { if (is_uploaded_file($_FILES['SelectEditionFile']['tmp_name'])) { // Załaduj plik: $file = $_FILES['SelectEditionFile']['name']; $ext = @substr($file, @strrpos($file, '.') ? @strrpos($file, '.') + 1 : @strlen($file), @strlen($file)); $paper = 'Paper/Blask_' . $_POST['Year'] . '-' . $_POST['Month'] . '.' . $ext; @unlink($paper); if (!move_uploaded_file($_FILES['SelectEditionFile']['tmp_name'], $paper)) // HERE PROBLEM { $_SESSION['Error'] = 'Cannot move uploaded file.'; } .... |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
R.A.M. wrote:
> In the code below I cannot move uploaded file. I don't know why. The folder > Paper has priviledges rwxrwxrwx. $_POST['Year'] and $_POST['Month'] are > valid. > Please . > Thanks in advance! > > <?php > session_start(); > if ($_SERVER['REQUEST_METHOD'] == 'POST' && > isset($_POST['EditionFile']) && isset($_POST['Year']) && > isset($_POST['Month'])) > { > if (is_uploaded_file($_FILES['SelectEditionFile']['tmp_name'])) > { > // Załaduj plik: > $file = $_FILES['SelectEditionFile']['name']; > $ext = @substr($file, > @strrpos($file, '.') ? @strrpos($file, '.') + 1 : @strlen($file), > @strlen($file)); > $paper = 'Paper/Blask_' . $_POST['Year'] . '-' . $_POST['Month'] . '.' . > $ext; > @unlink($paper); > if (!move_uploaded_file($_FILES['SelectEditionFile']['tmp_name'], $paper)) > // HERE PROBLEM > { > $_SESSION['Error'] = 'Cannot move uploaded file.'; > } > ... Is Paper/ actually in the root directory of the PHP system tho? Try an absolute file path. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
R.A.M. wrote:
> In the code below I cannot move uploaded file. I don't know why. The folder > Paper has priviledges rwxrwxrwx. $_POST['Year'] and $_POST['Month'] are > valid. > Please . > Thanks in advance! > > <?php > session_start(); > if ($_SERVER['REQUEST_METHOD'] == 'POST' && > isset($_POST['EditionFile']) && isset($_POST['Year']) && > isset($_POST['Month'])) > { > if (is_uploaded_file($_FILES['SelectEditionFile']['tmp_name'])) > { > // Załaduj plik: > $file = $_FILES['SelectEditionFile']['name']; > $ext = @substr($file, > @strrpos($file, '.') ? @strrpos($file, '.') + 1 : @strlen($file), > @strlen($file)); > $paper = 'Paper/Blask_' . $_POST['Year'] . '-' . $_POST['Month'] . '.' . > $ext; > @unlink($paper); > if (!move_uploaded_file($_FILES['SelectEditionFile']['tmp_name'], $paper)) > // HERE PROBLEM > { > $_SESSION['Error'] = 'Cannot move uploaded file.'; > } > ... > Enable all errors and display them. In your php.ini file: error_reporting=E_ALL display_errors=on (Which should be on for any development system). What message do you get? -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
![]() |
| Outils de la discussion | |
|
|