Вопрос по file-upload, jsf, remote-server, java, http – Как загрузить файл на http удаленного сервера с помощью Java? [Дубликат]

7

This question already has an answer here:

Error: User Rate Limit Exceeded

Error: User Rate Limit ExceededwrongError: User Rate Limit ExceededparseError: User Rate Limit Exceededcreate and sendError: User Rate Limit Exceeded BalusC
Error: User Rate Limit Exceeded Alexis Dufrenoy
Error: User Rate Limit Exceeded zorro6064
Error: User Rate Limit Exceeded rt.jar

Ваш Ответ

6   ответов
-3

Error: User Rate Limit Exceeded

@Autowired
ServletContext c;

Error: User Rate Limit Exceeded

byte[] bytes = file.getBytes();

String UPLOAD_FOLDEdR=c.getRealPath("/images");  
Path path = Paths.get(UPLOAD_FOLDEdR +"/"+ file.getOriginalFilename());
Files.write(path, bytes);
System.out.println(path);
String Pic_Name =file.getOriginalFilename();
Error: User Rate Limit Exceeded
0

2

        byte[] data = bos.toByteArray();//convert ur file into byte[]
        HttpClient httpClient = new DefaultHttpClient();//Client
        HttpPost postRequest = new HttpPost(YOUR_SERVER_URL);//Post Request to specified URL
        ByteArrayBody bab = new ByteArrayBody(data, "a.txt");
        MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);// Multipart data
        reqEntity.addPart("uploadingFile", bab); //adding data to request entity
        postRequest.setEntity(reqEntity);//adding request entity to post request
        HttpResponse response = httpClient.execute(postRequest); 
Error: User Rate Limit Exceeded zorro6064
Error: User Rate Limit Exceeded zorro6064
Error: User Rate Limit Exceeded
3

Error: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit Exceeded.

1

6

Error: User Rate Limit Exceeded zorro6064
Error: User Rate Limit Exceeded

Похожие вопросы