{"id":24857,"date":"2015-08-02T22:56:03","date_gmt":"2015-08-02T17:26:03","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=24857"},"modified":"2015-08-04T11:36:32","modified_gmt":"2015-08-04T06:06:32","slug":"file-upload-on-amazon-s3-server-using-curl-request","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/file-upload-on-amazon-s3-server-using-curl-request\/","title":{"rendered":"File Upload on Amazon S3 server using CURL request :"},"content":{"rendered":"<p><strong>Use Case :<\/strong> Sometimes we need to <a title=\"Upload File on Amazon S3 Using Amazon SDK\" href=\"http:\/\/www.tothenew.com\/blog\/upload-file-on-amazon-s3-using-amazon-sdk\/\">upload file on Amazon S3<\/a> or need to write code to upload file. As file upload on S3 using API call requires parameters in specific format and debugging that is very cumbersome task, in that case we can use CURL request with the inputs for debugging.<\/p>\n<p><strong>Following are the required Inputs for CURL:<\/strong><\/p>\n<ul>\n<li>Date in a specific format RFC 2822.<\/li>\n<li>Bucket name which is already created on S3.<\/li>\n<li>File which needs to be uploaded.<\/li>\n<li>ContentType is the type of file.<\/li>\n<li>Access Key of S3 server.<\/li>\n<li>Secret key of S3 Server.<\/li>\n<li>Base64 Encoded Signature by using S3 secret key.<\/li>\n<\/ul>\n<p>First we will create signature string using content-type, date and resource.<br \/>\nThis string will be base 64 encoded using S3 secret key which will be our signature.<\/p>\n<p><strong>Following is the CURL request :<\/strong><\/p>\n<p>[code language=&#8221;java&#8221;]<\/p>\n<p>date=`date +%Y%m%d`<br \/>\ndateFormatted=`date -R`<br \/>\ns3Bucket=&quot;BUCKET_OF_S3_SERVER&quot;<br \/>\nfileName=&quot;FILE_NAME&quot;<br \/>\nrelativePath=&quot;\/${s3Bucket}\/${fileName}&quot;<br \/>\ncontentType=&quot;application\/octet-stream&quot;<br \/>\nstringToSign=&quot;PUT\\n\\n${contentType}\\n${dateFormatted}\\n${relativePath}&quot;<br \/>\ns3AccessKey=&quot;ACCESS_KEY_OF_S3_SERVER&quot;<br \/>\ns3SecretKey=&quot;SECRET_KEY_OF_S3_SERVER&quot;<br \/>\nsignature=`echo -en ${stringToSign} | openssl sha1 -hmac ${s3SecretKey} -binary | base64`<br \/>\ncurl -X PUT -T &quot;${fileName}&quot; \\<br \/>\n-H &quot;Host: ${s3Bucket}.s3.amazonaws.com&quot; \\<br \/>\n-H &quot;Date: ${dateFormatted}&quot; \\<br \/>\n-H &quot;Content-Type: ${contentType}&quot; \\<br \/>\n-H &quot;Authorization: AWS ${s3AccessKey}:${signature}&quot; \\<br \/>\nhttp:\/\/${s3Bucket}.s3.amazonaws.com\/${fileName}<\/p>\n<p>[\/code]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use Case : Sometimes we need to upload file on Amazon S3 or need to write code to upload file. As file upload on S3 using API call requires parameters in specific format and debugging that is very cumbersome task, in that case we can use CURL request with the inputs for debugging. Following are [&hellip;]<\/p>\n","protected":false},"author":180,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":197,"footnotes":""},"categories":[1],"tags":[814],"class_list":["post-24857","post","type-post","status-publish","format-standard","hentry","category-technology","tag-curl"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Use Case : Sometimes we need to upload file on Amazon S3 or need to write code to upload file. As file upload on S3 using API call requires parameters in specific format and debugging that is very cumbersome task, in that case we can use CURL request with the inputs for debugging. Following are\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Lovin Saini\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.tothenew.com\/blog\/file-upload-on-amazon-s3-server-using-curl-request\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"File Upload on Amazon S3 server using CURL request : | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Use Case : Sometimes we need to upload file on Amazon S3 or need to write code to upload file. As file upload on S3 using API call requires parameters in specific format and debugging that is very cumbersome task, in that case we can use CURL request with the inputs for debugging. Following are\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.tothenew.com\/blog\/file-upload-on-amazon-s3-server-using-curl-request\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"File Upload on Amazon S3 server using CURL request : | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Use Case : Sometimes we need to upload file on Amazon S3 or need to write code to upload file. As file upload on S3 using API call requires parameters in specific format and debugging that is very cumbersome task, in that case we can use CURL request with the inputs for debugging. Following are\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/file-upload-on-amazon-s3-server-using-curl-request\\\/#article\",\"name\":\"File Upload on Amazon S3 server using CURL request : | TO THE NEW Blog\",\"headline\":\"File Upload on Amazon S3 server using CURL request :\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/lovin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2015-08-02T22:56:03+05:30\",\"dateModified\":\"2015-08-04T11:36:32+05:30\",\"inLanguage\":\"en-US\",\"commentCount\":2,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/file-upload-on-amazon-s3-server-using-curl-request\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/file-upload-on-amazon-s3-server-using-curl-request\\\/#webpage\"},\"articleSection\":\"Technology, curl\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/file-upload-on-amazon-s3-server-using-curl-request\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/file-upload-on-amazon-s3-server-using-curl-request\\\/#listItem\",\"name\":\"File Upload on Amazon S3 server using CURL request :\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/file-upload-on-amazon-s3-server-using-curl-request\\\/#listItem\",\"position\":3,\"name\":\"File Upload on Amazon S3 server using CURL request :\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/lovin\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/lovin\\\/\",\"name\":\"Lovin Saini\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/file-upload-on-amazon-s3-server-using-curl-request\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3167e13a82471322a375185207258a9b3a50f780ff53cad7288d42897edd6bf9?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Lovin Saini\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/file-upload-on-amazon-s3-server-using-curl-request\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/file-upload-on-amazon-s3-server-using-curl-request\\\/\",\"name\":\"File Upload on Amazon S3 server using CURL request : | TO THE NEW Blog\",\"description\":\"Use Case : Sometimes we need to upload file on Amazon S3 or need to write code to upload file. As file upload on S3 using API call requires parameters in specific format and debugging that is very cumbersome task, in that case we can use CURL request with the inputs for debugging. Following are\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/file-upload-on-amazon-s3-server-using-curl-request\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/lovin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/lovin\\\/#author\"},\"datePublished\":\"2015-08-02T22:56:03+05:30\",\"dateModified\":\"2015-08-04T11:36:32+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"File Upload on Amazon S3 server using CURL request : | TO THE NEW Blog","description":"Use Case : Sometimes we need to upload file on Amazon S3 or need to write code to upload file. As file upload on S3 using API call requires parameters in specific format and debugging that is very cumbersome task, in that case we can use CURL request with the inputs for debugging. Following are","canonical_url":"https:\/\/www.tothenew.com\/blog\/file-upload-on-amazon-s3-server-using-curl-request\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.tothenew.com\/blog\/file-upload-on-amazon-s3-server-using-curl-request\/#article","name":"File Upload on Amazon S3 server using CURL request : | TO THE NEW Blog","headline":"File Upload on Amazon S3 server using CURL request :","author":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/lovin\/#author"},"publisher":{"@id":"https:\/\/www.tothenew.com\/blog\/#organization"},"datePublished":"2015-08-02T22:56:03+05:30","dateModified":"2015-08-04T11:36:32+05:30","inLanguage":"en-US","commentCount":2,"mainEntityOfPage":{"@id":"https:\/\/www.tothenew.com\/blog\/file-upload-on-amazon-s3-server-using-curl-request\/#webpage"},"isPartOf":{"@id":"https:\/\/www.tothenew.com\/blog\/file-upload-on-amazon-s3-server-using-curl-request\/#webpage"},"articleSection":"Technology, curl"},{"@type":"BreadcrumbList","@id":"https:\/\/www.tothenew.com\/blog\/file-upload-on-amazon-s3-server-using-curl-request\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.tothenew.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/www.tothenew.com\/blog\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/file-upload-on-amazon-s3-server-using-curl-request\/#listItem","name":"File Upload on Amazon S3 server using CURL request :"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/file-upload-on-amazon-s3-server-using-curl-request\/#listItem","position":3,"name":"File Upload on Amazon S3 server using CURL request :","previousItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/technology\/#listItem","name":"Technology"}}]},{"@type":"Organization","@id":"https:\/\/www.tothenew.com\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/www.tothenew.com\/blog\/"},{"@type":"Person","@id":"https:\/\/www.tothenew.com\/blog\/author\/lovin\/#author","url":"https:\/\/www.tothenew.com\/blog\/author\/lovin\/","name":"Lovin Saini","image":{"@type":"ImageObject","@id":"https:\/\/www.tothenew.com\/blog\/file-upload-on-amazon-s3-server-using-curl-request\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/3167e13a82471322a375185207258a9b3a50f780ff53cad7288d42897edd6bf9?s=96&d=mm&r=g","width":96,"height":96,"caption":"Lovin Saini"}},{"@type":"WebPage","@id":"https:\/\/www.tothenew.com\/blog\/file-upload-on-amazon-s3-server-using-curl-request\/#webpage","url":"https:\/\/www.tothenew.com\/blog\/file-upload-on-amazon-s3-server-using-curl-request\/","name":"File Upload on Amazon S3 server using CURL request : | TO THE NEW Blog","description":"Use Case : Sometimes we need to upload file on Amazon S3 or need to write code to upload file. As file upload on S3 using API call requires parameters in specific format and debugging that is very cumbersome task, in that case we can use CURL request with the inputs for debugging. Following are","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.tothenew.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.tothenew.com\/blog\/file-upload-on-amazon-s3-server-using-curl-request\/#breadcrumblist"},"author":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/lovin\/#author"},"creator":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/lovin\/#author"},"datePublished":"2015-08-02T22:56:03+05:30","dateModified":"2015-08-04T11:36:32+05:30"},{"@type":"WebSite","@id":"https:\/\/www.tothenew.com\/blog\/#website","url":"https:\/\/www.tothenew.com\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.tothenew.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"File Upload on Amazon S3 server using CURL request : | TO THE NEW Blog","og:description":"Use Case : Sometimes we need to upload file on Amazon S3 or need to write code to upload file. As file upload on S3 using API call requires parameters in specific format and debugging that is very cumbersome task, in that case we can use CURL request with the inputs for debugging. Following are","og:url":"https:\/\/www.tothenew.com\/blog\/file-upload-on-amazon-s3-server-using-curl-request\/","og:image":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"File Upload on Amazon S3 server using CURL request : | TO THE NEW Blog","twitter:description":"Use Case : Sometimes we need to upload file on Amazon S3 or need to write code to upload file. As file upload on S3 using API call requires parameters in specific format and debugging that is very cumbersome task, in that case we can use CURL request with the inputs for debugging. Following are","twitter:image":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"24857","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":"","og_description":"","og_object_type":"blog","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":"","og_article_tags":"","twitter_use_og":false,"twitter_card":"summary","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-29 12:15:21","updated":"2024-02-29 08:25:58","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.tothenew.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.tothenew.com\/blog\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tFile Upload on Amazon S3 server using CURL request :\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.tothenew.com\/blog"},{"label":"Technology","link":"https:\/\/www.tothenew.com\/blog\/category\/technology\/"},{"label":"File Upload on Amazon S3 server using CURL request :","link":"https:\/\/www.tothenew.com\/blog\/file-upload-on-amazon-s3-server-using-curl-request\/"}],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/24857","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/180"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=24857"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/24857\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=24857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=24857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=24857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}