Visualizzazione dei risultati da 1 a 7 su 7
  1. #1

    upload file recupero file

    salve.
    Ho scaricato un codice per l'upload dei file funziona cioe se invio il file nel server lo trovo nella cartella che io ho settato.

    Il problema nasce quando io cerco dal server di recuperare il file smartftp mi da questo errore:

    [12:17:40] 257 "/html/test/upload/pictures" is current directory.
    [12:17:41] TYPE I
    [12:17:41] 200 Type set to I
    [12:17:41] SIZE home_10.jpg
    [12:17:41] 213 159698
    [12:17:41] MDTM home_10.jpg
    [12:17:41] 213 20061022095131
    [12:17:41] No rule matched. Default Action="Ask".
    [12:17:44] PASV
    [12:17:44] 227 Entering Passive Mode (85,25,88,21,225,188).
    [12:17:44] Apertura connessione dati con 85.25.88.21 - Porta: 57788
    [12:17:44] RETR home_10.jpg
    [12:17:44] 550 home_10.jpg: Permission denied
    [12:17:44] MDTM home_10.jpg
    [12:17:44] 213 20061022095131
    [12:17:44] Transfer failed.

    Permission denied? questo proprio non lo capisco perche non dovrei avere il permesso per riprendere il file, questo succede solo con i file che sono stati inviati cioe se io cerco di recuperare una foto che io precedentemente ho caricato nel server tramite smartftp e non con lo script di upload l'operazione avviene normalmente.

    Io divento schemo mi date na mano?

    grazie#
    <-------------------------------->
    Se non avessimo difetti, non ci farebbe tanto piacere trovarne negli altri.
    <-------------------------------->
    Andate sempre contro il vento...Solo così imparerete a volare...

  2. #2
    apache e l'ftp accedono con utenti diversi.

    Verifica di aver assegnato il permesso in lettura per tutti sui file caricati con l'upload in php.

  3. #3
    Se non ho capito male tu dice di settare il php ini?
    Se questo che intendi non possso il file é on line.

    se ti riferisci al permesso chmod della cartella dove sono contenuti i file e settata su 0777.
    <-------------------------------->
    Se non avessimo difetti, non ci farebbe tanto piacere trovarne negli altri.
    <-------------------------------->
    Andate sempre contro il vento...Solo così imparerete a volare...

  4. #4
    Volevo ancora dire che se ti riferisci al file caricato il per messo e settato su 600 se cerco di cambiarlo ho questo messagio:

    [12:39:28] SITE CHMOD 700 home_10.jpg
    [12:39:28] 550 home_10.jpg: Operation not permitted
    <-------------------------------->
    Se non avessimo difetti, non ci farebbe tanto piacere trovarne negli altri.
    <-------------------------------->
    Andate sempre contro il vento...Solo così imparerete a volare...

  5. #5
    Originariamente inviato da fabione_htm
    Volevo ancora dire che se ti riferisci al file caricato il per messo e settato su 600 se cerco di cambiarlo ho questo messagio:

    [12:39:28] SITE CHMOD 700 home_10.jpg
    [12:39:28] 550 home_10.jpg: Operation not permitted
    Sì, intendo il file caricato, e ovviamente il chmod devi farlo da php dopo averlo creato, per permettere anche all'ftp di leggerlo.

  6. #6
    lo script non lo creato io quindi non ho proprio idea di dove mettere le mani ti invio lo script magari mi puoi dire dove devo aggire:

    class.upload.php:

    <?php
    /**
    * class.upload.php - Upload-Class
    * Part of mOOwe ('my Object Oriented website engine')
    *
    * This library is to be distruibuted under the terms of the
    * GNU LESSER GENERAL PUBLIC LICENSE! See license.txt for details.
    *
    * @version 0.0.2
    * @author Michel Weimerskirch <michel@weimerskirch.net>
    */
    class upload{
    var $error_msg = '';
    /**
    * Constructor
    *
    * @param string $input_field_name form field name of uploaded file
    */
    function upload($input_field_name){
    $this->input_field_name = $input_field_name;
    }

    /**
    * Set the maximum file size
    *
    * @param array $accepted_mime_types Accepted MIME-types
    */
    function set_accepted_mime_types($accepted_mime_types){
    $this->accepted_mime_types = $accepted_mime_types;
    }

    /**
    * Set the maximum file size
    *
    * @param int $max_size Maximum file size in bytes
    */
    function set_max_file_size($max_size){
    $this->max_file_size = $max_size;
    }

    /**
    * Sets the maximum pixel dimensions for image uploads
    *
    * @param int $width Maximum width of uploaded images (pixels)
    * @param int $height Maximum height of uploaded images uploads
    */
    function set_max_image_size($width, $height){
    $this->max_image_width = $width;
    $this->max_image_height = $height;
    }

    /**
    * Draw a simple upload-form (all elements in one line).
    *
    * @param string $title
    * @param string $action Value for the "action" attribute of the <form> tag
    */
    function draw_simple_form($title = "Upload", $action = ''){
    if (isset($this->max_file_size)){
    $maxlenght = " maxlength=\"{$this->max_file_size}\"";
    }else{
    $maxlenght = '';
    }

    if (isset($this->accepted_mime_types)){
    $accept = ' accept="' . implode(',', $this->accepted_mime_types) . '"';
    }else{
    $accepted = '';
    }

    echo "<form enctype=\"multipart/form-data\" action=\"{$action}\" method=\"post\">";
    echo $title . ": <input name=\"{$this->input_field_name}\" type=\"file\"$accept$maxlenght>";
    echo "<input type=\"submit\" value=\"Send File\">";
    echo "</form>";
    }

    /**
    * Draw an upload-form
    *
    * @param string $title
    * @param string $action Value for the "action" attribute of the <form> tag
    */
    function draw_form($title = "Upload", $action = ''){
    if (isset($this->max_file_size)){
    $maxlenght = " maxlength=\"{$this->max_file_size}\"";
    }else{
    $maxlenght = '';
    }

    if (isset($this->accepted_mime_types)){
    $accept = ' accept="' . implode(',', $this->accepted_mime_types) . '"';
    }else{
    $accepted = '';
    }

    echo "<form enctype=\"multipart/form-data\" action=\"{$action}\" method=\"post\">";
    echo $title . ":
    ";
    echo "<input name=\"{$this->input_field_name}\" type=\"file\"$accept$maxlenght>";
    echo "

    <input type=\"submit\" value=\"Send File\">";
    echo "</form>";

    if (isset($this->accepted_mime_types)){
    echo "This form only accepts the following MIME-types: " . implode(', ', $this->accepted_mime_types) . "
    ";
    }
    }

    /**
    * Make some security-checks (e.g. file-size, MIME-type,...)
    */
    function security_check(){
    if (is_uploaded_file($_FILES[$this->input_field_name][tmp_name])){
    $this->file = $_FILES[$this->input_field_name];
    }else{
    $this->error_msg = "Uploaded file does not exist!";
    return false;
    }

    if(isset($this->max_file_size) && ($this->file["size"] > $this->max_file_size)){
    $this->error_msg .= "Maximum file size exceeded . Uploaded files may not be larger than " . $this->max_file_size . " bytes . (= " . round($this->max_file_size / 1024, 2) . "KB)";
    return false;
    }

    if(ereg("image", $this->file["type"])){
    $image_size = getimagesize($this->file["tmp_name"]);

    if(isset($this->max_image_width) && isset($this->max_image_height) &&
    ($image_size[0] > $this->max_image_width) || ($image_size[1] > $this->max_image_height)){
    $this->error_msg .= "Maximum image size exceeded . Image may be no more than " . $this->max_image_width . " x " . $this->max_image_height . " pixels";
    return false;
    }
    }

    /**
    * If the class should only allow some specific MIME-types,
    * it will now check if the MIME-type is allowed.
    */
    if(isset($this->accepted_mime_types) && !in_array($this->file["type"], $this->accepted_mime_types)){
    $this->error_msg = "This MIME - type is not accepted!
    \n";
    $this->error_msg .= "Given: {$this->file["type"]}
    \n";
    $this->error_msg .= "Expected: " . implode(', ', $this->accepted_mime_types);
    return false;
    }

    return true;
    }

    /**
    * Moves the uploaded file
    *
    * @param string $destination_folder
    * @param boolean $overwrite
    */
    function move($destination_folder, $overwrite = false){
    if ($this->security_check() == false){
    return false;
    }

    $filename = $this->file['tmp_name'];
    $destination = $destination_folder . $this->file['name'];
    if (file_exists($destination) && $overwrite != true){
    $this->error_msg = "This file already exists";
    return false;
    }elseif (move_uploaded_file ($filename, $destination)){
    return true;
    }else{
    $this->error_msg = "Error moving the uploaded file!";
    return false;
    }
    }

    /**
    * Read the content from the file and return it as a binary string.
    *
    * @return string The (binary) content of the file
    */
    function read(){
    if ($this->security_check() == false){
    return false;
    }

    $filename = $this->file['tmp_name'];
    $fd = fopen ($filename, "rb");
    $contents = fread ($fd, filesize ($filename));
    fclose ($fd);

    return $contents;
    }
    }

    ?>

    poi ho Picture Upload:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <link rel="stylesheet" href="adm_style.css" type="text/css">
    <title>Picture Upload</title>
    </head>
    <body>
    <?php

    require("class.upload.php");


    $input_field_name = "picturefile";
    $accepted_mime_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/pjpeg');
    $destination_folder = "pictures/";
    $overwrite = false; //Overwrite the file if it exists

    $upload = new upload($input_field_name);

    /**
    * The following three lines are optional.
    * They set some upload-limits.
    */
    $upload->set_max_file_size(500000);
    $upload->set_max_image_size(800, 800); //in pixels
    $upload->set_accepted_mime_types($accepted_mime_types);

    $upload->draw_form('Upload pictures', 'upload-example.php'); //the second argument is optional

    if ($_SERVER['REQUEST_METHOD'] == 'POST'){
    $result = $upload->move($destination_folder, $overwrite);

    if ($result == true){
    echo "
    " . $upload->file['name'] . " was successfully uploaded!
    ";
    }else{
    echo "
    " . $upload->error_msg . "";
    }
    }

    ?>
    </body>
    </html>
    <-------------------------------->
    Se non avessimo difetti, non ci farebbe tanto piacere trovarne negli altri.
    <-------------------------------->
    Andate sempre contro il vento...Solo così imparerete a volare...

  7. #7
    mi sa che ho esagerato ad inviare il codice ma proprio non ne esco non só piú quanti post avro letto senza riuscire trovare una soluzione.

    Comunque ho notato che le foto che inserisco tramite ftp hanno un user e un grup mentre le foto inviate dal sito ne hanno un altro.

    Sono anche riuscito a scaricare le foto inviate dal sito con uno stratagemma e cioé nella cartella dove sono contenute le foto creo un nuovo utente ftp dopo di che lo cancello rendendo quindi le foto scaricabili.

    Spero che con questi indizi possiate aiutarmi a risolvere questo problema non credo che sia l'unico ad averlo.

    grazie
    <-------------------------------->
    Se non avessimo difetti, non ci farebbe tanto piacere trovarne negli altri.
    <-------------------------------->
    Andate sempre contro il vento...Solo così imparerete a volare...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.