Tải lên tệp Php GitHub
Ngày đăng:
01/02/2023
Trả lời:
0
Lượt xem:
88
Trình tải lên tệp PHP là một Tập lệnh tải lên tệp hiệu suất cao, dễ sử dụng, cho phép bạn tải lên/tải xuống các tệp lên máy chủ web Show Thử nghiệm. Tài liệu. Trình tải tệp lên Cách sử dụngTải lên include('src/class.uploader.php'); $uploader = new Uploader(); $data = $uploader->upload($_FILES['files'], array( 'limit' => 10, //Maximum Limit of files. {null, Number} 'maxSize' => 10, //Maximum Size of files {null, Number(in MB's)} 'extensions' => null, //Whitelist for file extension. {null, Array(ex: array('jpg', 'png'))} 'required' => false, //Minimum one file is required for upload {Boolean} 'uploadDir' => 'uploads/', //Upload directory {String} 'title' => array('auto', 10), //New file name {null, String, Array} *please read documentation in README.md 'removeFiles' => true, //Enable file exclusion {Boolean(extra for jQuery.filer), String($_POST field name containing json data with file names)} 'replace' => false, //Replace the file if it already exists {Boolean} 'perms' => null, //Uploaded file permisions {null, Number} 'onCheck' => null, //A callback function name to be called by checking a file for errors (must return an array) | ($file) | Callback 'onError' => null, //A callback function name to be called if an error occured (must return an array) | ($errors, $file) | Callback 'onSuccess' => null, //A callback function name to be called if all files were successfully uploaded | ($files, $metas) | Callback 'onUpload' => null, //A callback function name to be called if all files were successfully uploaded (must return an array) | ($file) | Callback 'onComplete' => null, //A callback function name to be called when upload is complete | ($file) | Callback 'onRemove' => 'onFilesRemoveCallback' //A callback function name to be called by removing files (must return an array) | ($removed_files) | Callback )); if($data['isComplete']){ $files = $data['data']; print_r($files); } if($data['hasErrors']){ $errors = $data['errors']; print_r($errors); } Tải xuống include('src/class.uploader.php'); $uploader = new Uploader(); $data = $uploader->upload('https://www.google.com/images/srpr/logo11w.png', array( 'uploadDir' => 'uploads/', //Upload directory {String} 'title' => array('auto', 10), //New file name {null, String, Array} *please read documentation in README.md )); if($data['isComplete']){ $files = $data['data']; print_r($files); } if($data['hasErrors']){ $errors = $data['errors']; print_r($errors); } Tùy chọnTài liệu đầy đủ về các tùy chọn và tính năng của lớp
Ủng hộCâu hỏi hoặc cần giúp đỡ? . Đảm bảo bạn thêm các thẻ "php", "php-upload" và "jquery. filer" khi đăng Nếu bạn gặp sự cố và cần báo cáo lỗi hoặc bạn chỉ có câu hỏi, vui lòng tạo Sự cố trên các vấn đề của GitHub và chúng tôi sẽ điều tra vấn đề đó Làm cách nào để tải lên một tệp trong PHP?Tải lên tệp PHP . Định cấu hình "php. ini" Tập tin. Trước tiên, hãy đảm bảo rằng PHP được định cấu hình để cho phép tải tệp lên. . Kiểm tra xem tệp đã tồn tại chưa. Bây giờ chúng ta có thể thêm một số hạn chế. . Kích thước tệp giới hạn. Trường nhập tệp trong biểu mẫu HTML của chúng tôi ở trên được đặt tên là "fileToUpload". . Loại tệp giới hạn. . Hoàn thành tải lên tệp PHP Script GitHub có chạy PHP không?Trang GitHub không hỗ trợ các ngôn ngữ phía máy chủ như PHP , Ruby hoặc Python.
Làm cách nào để lưu tệp đã tải lên trong thư mục bằng PHP? |