0,'text'=>'Vui lòng nhập tên thư mục']; } else{ $r=s3_send_request($cfg,'PUT',$cfg['bucket'],$prefix,[],['Content-Type'=>'application/x-directory'],''); $msg=$r['ok']?['ok'=>1,'text'=>"📁 Đã tạo thư mục: $prefix"]:['ok'=>0,'text'=>"❌ Lỗi tạo thư mục (HTTP {$r['http_code']})"]; } } else { // upload file if(!isset($_FILES['file']) || !is_uploaded_file($_FILES['file']['tmp_name'])){ $msg=['ok'=>0,'text'=>'Vui lòng chọn file']; } else { $f=$_FILES['file']; $prefix=s3_norm_prefix($_POST['prefix'] ?? ''); $keyInput=trim((string)($_POST['key'] ?? '')); $key = $keyInput !== '' ? ltrim($keyInput,'/') : s3_join($prefix, $f['name']); $ctype=$f['type']?:'application/octet-stream'; $fh=fopen($f['tmp_name'],'rb'); $r=s3_send_request($cfg,'PUT',$cfg['bucket'],$key,[],['Content-Type'=>$ctype],$fh); fclose($fh); $msg=$r['ok']?['ok'=>1,'text'=>"✅ Upload thành công: $key"]:['ok'=>0,'text'=>"❌ Upload lỗi (HTTP {$r['http_code']})\n".substr($r['body'],0,200)]; } } } ?> Upload

📤 Upload vào:


← Trang chínhXem danh sáchSource