473,394 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Issues when I upload multiple files to Alibaba Cloud OSS

22
When I upload multiple files to Alibaba Cloud OSS, do I upload files one by one or upload the entire directory at one go?
Alibaba Cloud OSS provides two methods for uploading files.
//Upload a file through multipart upload
function upload_by_multi_part($obj){
$bucket = 'phpsdk1349849394';
$object = 'Mining.the.Social.Web-'.time().'.pdf'; //English
$filepath = "D:\\Book\\Mining.the.Social.Web.pdf"; //English

$options = array(
ALIOSS::OSS_FILE_UPLOAD => $filepath,
'partSize' => 5242880,
);

$response = $obj->create_mpu_object($bucket, $object,$options);
_format($response);
}

//Upload the entire directory using multipart upload
function upload_by_dir($obj){
$bucket = 'phpsdk1349849394';
$dir = "D:\\alidata\\www\\logs\\aliyun.com\\oss\\";
$recursive = false;

$response = $obj->create_mtu_object_by_dir($bucket,$dir,$recursive) ;
var_dump($response);
}
Two approaches are available:
1. The first approach is uploading individual files a time. When the server received N files, it uploads the files in N times using the first function.
2. The second approach is transferring multiple files from a temporary directory to under a folder file and upload them all together using the second function. But I think it is too troublesome – creating a new folder to save the files to be uploaded, and then deleting the folder after the upload is done.
Which approach is better? If the second one is better, can I just create an exclusive temporary directory for the N files directly at the upload?
May 3 '18 #1
1 2087
IvanH
51
The possibility of upload failure has not been considered.
If the first approach is used, you can upload each file to be uploaded. If the second approach is used, when the upload fails, do you re-upload them all or are there other alternative solutions?
Honestly, I cannot see the advantage of the second approach. How is the second approach different from the first one, except in packaged uploading?
To sum up, the first approach sounds safer. The second approach involves too much to consider, without generating any overwhelming convenience. The loss outweighs the gain.
May 4 '18 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: x. zhang | last post by:
Hi Guys, We know that we can use <input type=file ...> to upload one file per time to the server. My question is if there are some way to upload multiple files per time to the server. (Of...
1
by: Susan | last post by:
Is it possible to use PHP with VBScript or JavaScript to upload multiple files. I'd like to automate the upload of a complete directory (not using FTP). I don't need a common form with several...
3
by: JFB | last post by:
Hi All, It's a way to upload multiple files on a web site using vb.net 2005? I see the uploadFile tool, but it's only for one file. Any ideas, examples, links??? Tks in advance JFB
0
by: deepaks85 | last post by:
Dear Friends, I am trying to upload multiple files. But I can't find why it is not working fine. Here is the code......... numfile.php <form method="POST" action="fileupload.php"> <p...
0
by: deepaks85 | last post by:
Dear Friends, I am trying to upload multiple files. But I can't find why it is not working fine. Here is the code......... numfile.php <form method="POST" action="fileupload.php"> <p...
10
by: Sebarry | last post by:
Hi, I'm using the code at http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/ to upload multiple files with a single file element. It works fine...
43
by: bonneylake | last post by:
Hey Everyone, Well this is my first time asking a question on here so please forgive me if i post my question in the wrong section. What i am trying to do is upload multiple files like gmail...
3
by: djia002 | last post by:
Hello everyone, I am new to Perl, and stuck with file uploading issue. My Html is this, <form enctype="multipart/form-data" method=post action="/cgi-bin/upload/mfile.pl"> <input type=file...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.