{"id":1501,"date":"2020-08-09T16:55:14","date_gmt":"2020-08-09T08:55:14","guid":{"rendered":"https:\/\/zaf.web.id\/blog\/?p=1501"},"modified":"2024-09-06T00:22:23","modified_gmt":"2024-09-05T16:22:23","slug":"upload-file-sederhana-ke-aws-s3-dengan-php","status":"publish","type":"post","link":"https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/","title":{"rendered":"Upload File Sederhana ke AWS S3 dengan PHP"},"content":{"rendered":"<p><em>AWS<\/em> telah menyediakan <em>SDK<\/em> untuk memudahkan transaksi terhadap beberapa servicenya secara program, salah satu yang disediakan adalah untuk PHP. Namun terkadang kebutuhan tidak sesuai dengan usaha yang harus dikeluarkan. Untuk sekedar upload file ke <em>S3<\/em> milik <em>AWS<\/em> kita perlu <em>load\/download<\/em> paket lengkap dari <em>SDK<\/em> nya, rasanya agak berlebihan.<\/p>\n<p>Setelah <em>googling<\/em> beberapa waktu akhirnya ketemu <em>library<\/em> dalam bentuk <em>single file,<\/em> yang dapat digunakan untuk beberapa kegiatan di <em>S3,<\/em> salah satunya untuk upload file.<\/p>\n<p><em>Library<\/em> nya ada di <em>repository<\/em> <a href=\"https:\/\/github.com\/23Pstars\/simple-php-s3-upload\">https:\/\/github.com\/23Pstars\/simple-php-s3-upload<\/a><\/p>\n<p>Menggunakannya cukup sederhana, hanya perlu menyesuaikan script <code>index.php<\/code> dan melengkapi credentials untuk akun yang digunakan<\/p>\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist112218862\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-index-php\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-php  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"index.php content, created by 23Pstars on 08:03AM on October 06, 2021.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"index.php\">\n        <tr>\n          <td id=\"file-index-php-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-index-php-LC1\" class=\"blob-code blob-code-inner js-file-line\">&lt;?php<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-index-php-LC2\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-index-php-LC3\" class=\"blob-code blob-code-inner js-file-line\">include &#39;S3.php&#39;;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-index-php-LC4\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-index-php-LC5\" class=\"blob-code blob-code-inner js-file-line\">define(&#39;S3_ENDPOINT&#39;, &#39;s3.amazonaws.com&#39;);<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-index-php-LC6\" class=\"blob-code blob-code-inner js-file-line\">define(&#39;S3_BUCKET&#39;, &#39;bucket&#39;);<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-index-php-LC7\" class=\"blob-code blob-code-inner js-file-line\">define(&#39;S3_DIR&#39;, &#39;path\/to\/dir&#39;);<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-index-php-LC8\" class=\"blob-code blob-code-inner js-file-line\">define(&#39;S3_KEY&#39;, &#39;*****&#39;);<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-index-php-LC9\" class=\"blob-code blob-code-inner js-file-line\">define(&#39;S3_SECRET&#39;, &#39;*****&#39;);<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-index-php-LC10\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-index-php-LC11\" class=\"blob-code blob-code-inner js-file-line\">\/\/ submitted form<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-index-php-LC12\" class=\"blob-code blob-code-inner js-file-line\">$_stored_filename = &#39;file.txt&#39;;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-index-php-LC13\" class=\"blob-code blob-code-inner js-file-line\">$_file_tmp_name = $_FILES[&#39;tmp_name&#39;];<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-index-php-LC14\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-index-php-LC15\" class=\"blob-code blob-code-inner js-file-line\">new S3(S3_KEY, S3_SECRET, false, S3_ENDPOINT);<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-index-php-LC16\" class=\"blob-code blob-code-inner js-file-line\">S3::putObjectFile($_file_tmp_name, S3_BUCKET, S3_DIR . DS . $_stored_filename, S3::ACL_PUBLIC_READ);<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-index-php-LC17\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-index-php-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-index-php-LC18\" class=\"blob-code blob-code-inner js-file-line\">$_uploaded_file = &#39;https:\/\/&#39; . S3_ENDPOINT . DS . S3_BUCKET . DS . S3_DIR . DS . $_stored_filename;<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/23Pstars\/eeb2aa969efc4a8be015b87a643d3e9b\/raw\/65f45cd83d401d777fa88d90dbf24312ae9cdfea\/index.php\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/23Pstars\/eeb2aa969efc4a8be015b87a643d3e9b#file-index-php\" class=\"Link--inTextBlock\">\n          index.php\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>AWS telah menyediakan SDK untuk memudahkan transaksi terhadap beberapa servicenya secara program, salah satu yang&hellip;<\/p>\n","protected":false},"author":1,"featured_media":2094,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[57,58],"tags":[281,282],"class_list":["post-1501","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming","category-server","tag-aws","tag-s3"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Upload File Sederhana ke AWS S3 dengan PHP - Ahmad Zafrullah<\/title>\n<meta name=\"description\" content=\"Script untuk upload file sederhana di PHP menggunakan library AWS S3 dalam bentuk single file\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/\" \/>\n<meta property=\"og:locale\" content=\"id_ID\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Upload File Sederhana ke AWS S3 dengan PHP - Ahmad Zafrullah\" \/>\n<meta property=\"og:description\" content=\"Script untuk upload file sederhana di PHP menggunakan library AWS S3 dalam bentuk single file\" \/>\n<meta property=\"og:url\" content=\"https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/\" \/>\n<meta property=\"og:site_name\" content=\"Ahmad Zafrullah\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/www.facebook.com\/23Pstars\" \/>\n<meta property=\"article:author\" content=\"http:\/\/www.facebook.com\/23Pstars\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-09T08:55:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-05T16:22:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/zaf.web.id\/blog\/wp-content\/uploads\/2020\/08\/Screenshot-2024-09-06-at-00.22.03.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2150\" \/>\n\t<meta property=\"og:image:height\" content=\"1456\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Zaf\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@23Pstars\" \/>\n<meta name=\"twitter:site\" content=\"@23Pstars\" \/>\n<meta name=\"twitter:label1\" content=\"Ditulis oleh\" \/>\n\t<meta name=\"twitter:data1\" content=\"Zaf\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimasi waktu membaca\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 menit\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/upload-file-sederhana-ke-aws-s3-dengan-php\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/upload-file-sederhana-ke-aws-s3-dengan-php\\\/\"},\"author\":{\"name\":\"Zaf\",\"@id\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/#\\\/schema\\\/person\\\/ba4e955d59a1e6a8284857e74b14e5ed\"},\"headline\":\"Upload File Sederhana ke AWS S3 dengan PHP\",\"datePublished\":\"2020-08-09T08:55:14+00:00\",\"dateModified\":\"2024-09-05T16:22:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/upload-file-sederhana-ke-aws-s3-dengan-php\\\/\"},\"wordCount\":122,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/#\\\/schema\\\/person\\\/ba4e955d59a1e6a8284857e74b14e5ed\"},\"image\":{\"@id\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/upload-file-sederhana-ke-aws-s3-dengan-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/zaf.web.id\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/Screenshot-2024-09-06-at-00.22.03.png?fit=2150%2C1456&ssl=1\",\"keywords\":[\"aws\",\"s3\"],\"articleSection\":[\"Programming\",\"Server\"],\"inLanguage\":\"id\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/zaf.web.id\\\/blog\\\/upload-file-sederhana-ke-aws-s3-dengan-php\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/upload-file-sederhana-ke-aws-s3-dengan-php\\\/\",\"url\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/upload-file-sederhana-ke-aws-s3-dengan-php\\\/\",\"name\":\"Upload File Sederhana ke AWS S3 dengan PHP - Ahmad Zafrullah\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/upload-file-sederhana-ke-aws-s3-dengan-php\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/upload-file-sederhana-ke-aws-s3-dengan-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/zaf.web.id\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/Screenshot-2024-09-06-at-00.22.03.png?fit=2150%2C1456&ssl=1\",\"datePublished\":\"2020-08-09T08:55:14+00:00\",\"dateModified\":\"2024-09-05T16:22:23+00:00\",\"description\":\"Script untuk upload file sederhana di PHP menggunakan library AWS S3 dalam bentuk single file\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/upload-file-sederhana-ke-aws-s3-dengan-php\\\/#breadcrumb\"},\"inLanguage\":\"id\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/zaf.web.id\\\/blog\\\/upload-file-sederhana-ke-aws-s3-dengan-php\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"id\",\"@id\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/upload-file-sederhana-ke-aws-s3-dengan-php\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/zaf.web.id\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/Screenshot-2024-09-06-at-00.22.03.png?fit=2150%2C1456&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/zaf.web.id\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/Screenshot-2024-09-06-at-00.22.03.png?fit=2150%2C1456&ssl=1\",\"width\":2150,\"height\":1456},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/upload-file-sederhana-ke-aws-s3-dengan-php\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Upload File Sederhana ke AWS S3 dengan PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/\",\"name\":\"Ahmad Zafrullah\",\"description\":\"Work to Learn is better than Learn how to Work\",\"publisher\":{\"@id\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/#\\\/schema\\\/person\\\/ba4e955d59a1e6a8284857e74b14e5ed\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"id\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/#\\\/schema\\\/person\\\/ba4e955d59a1e6a8284857e74b14e5ed\",\"name\":\"Zaf\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"id\",\"@id\":\"https:\\\/\\\/i0.wp.com\\\/zaf.web.id\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/zaf_auto_x2.jpeg?fit=300%2C300&ssl=1\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/zaf.web.id\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/zaf_auto_x2.jpeg?fit=300%2C300&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/zaf.web.id\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/zaf_auto_x2.jpeg?fit=300%2C300&ssl=1\",\"width\":300,\"height\":300,\"caption\":\"Zaf\"},\"logo\":{\"@id\":\"https:\\\/\\\/i0.wp.com\\\/zaf.web.id\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/zaf_auto_x2.jpeg?fit=300%2C300&ssl=1\"},\"sameAs\":[\"http:\\\/\\\/zaf.web.id\",\"http:\\\/\\\/www.facebook.com\\\/23Pstars\",\"https:\\\/\\\/x.com\\\/23Pstars\"],\"url\":\"https:\\\/\\\/zaf.web.id\\\/blog\\\/author\\\/zaf\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Upload File Sederhana ke AWS S3 dengan PHP - Ahmad Zafrullah","description":"Script untuk upload file sederhana di PHP menggunakan library AWS S3 dalam bentuk single file","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/","og_locale":"id_ID","og_type":"article","og_title":"Upload File Sederhana ke AWS S3 dengan PHP - Ahmad Zafrullah","og_description":"Script untuk upload file sederhana di PHP menggunakan library AWS S3 dalam bentuk single file","og_url":"https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/","og_site_name":"Ahmad Zafrullah","article_publisher":"http:\/\/www.facebook.com\/23Pstars","article_author":"http:\/\/www.facebook.com\/23Pstars","article_published_time":"2020-08-09T08:55:14+00:00","article_modified_time":"2024-09-05T16:22:23+00:00","og_image":[{"width":2150,"height":1456,"url":"https:\/\/zaf.web.id\/blog\/wp-content\/uploads\/2020\/08\/Screenshot-2024-09-06-at-00.22.03.png","type":"image\/png"}],"author":"Zaf","twitter_card":"summary_large_image","twitter_creator":"@23Pstars","twitter_site":"@23Pstars","twitter_misc":{"Ditulis oleh":"Zaf","Estimasi waktu membaca":"1 menit"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/#article","isPartOf":{"@id":"https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/"},"author":{"name":"Zaf","@id":"https:\/\/zaf.web.id\/blog\/#\/schema\/person\/ba4e955d59a1e6a8284857e74b14e5ed"},"headline":"Upload File Sederhana ke AWS S3 dengan PHP","datePublished":"2020-08-09T08:55:14+00:00","dateModified":"2024-09-05T16:22:23+00:00","mainEntityOfPage":{"@id":"https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/"},"wordCount":122,"commentCount":0,"publisher":{"@id":"https:\/\/zaf.web.id\/blog\/#\/schema\/person\/ba4e955d59a1e6a8284857e74b14e5ed"},"image":{"@id":"https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2020\/08\/Screenshot-2024-09-06-at-00.22.03.png?fit=2150%2C1456&ssl=1","keywords":["aws","s3"],"articleSection":["Programming","Server"],"inLanguage":"id","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/","url":"https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/","name":"Upload File Sederhana ke AWS S3 dengan PHP - Ahmad Zafrullah","isPartOf":{"@id":"https:\/\/zaf.web.id\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/#primaryimage"},"image":{"@id":"https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2020\/08\/Screenshot-2024-09-06-at-00.22.03.png?fit=2150%2C1456&ssl=1","datePublished":"2020-08-09T08:55:14+00:00","dateModified":"2024-09-05T16:22:23+00:00","description":"Script untuk upload file sederhana di PHP menggunakan library AWS S3 dalam bentuk single file","breadcrumb":{"@id":"https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/#breadcrumb"},"inLanguage":"id","potentialAction":[{"@type":"ReadAction","target":["https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/#primaryimage","url":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2020\/08\/Screenshot-2024-09-06-at-00.22.03.png?fit=2150%2C1456&ssl=1","contentUrl":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2020\/08\/Screenshot-2024-09-06-at-00.22.03.png?fit=2150%2C1456&ssl=1","width":2150,"height":1456},{"@type":"BreadcrumbList","@id":"https:\/\/zaf.web.id\/blog\/upload-file-sederhana-ke-aws-s3-dengan-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/zaf.web.id\/blog\/"},{"@type":"ListItem","position":2,"name":"Upload File Sederhana ke AWS S3 dengan PHP"}]},{"@type":"WebSite","@id":"https:\/\/zaf.web.id\/blog\/#website","url":"https:\/\/zaf.web.id\/blog\/","name":"Ahmad Zafrullah","description":"Work to Learn is better than Learn how to Work","publisher":{"@id":"https:\/\/zaf.web.id\/blog\/#\/schema\/person\/ba4e955d59a1e6a8284857e74b14e5ed"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/zaf.web.id\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"id"},{"@type":["Person","Organization"],"@id":"https:\/\/zaf.web.id\/blog\/#\/schema\/person\/ba4e955d59a1e6a8284857e74b14e5ed","name":"Zaf","image":{"@type":"ImageObject","inLanguage":"id","@id":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2024\/09\/zaf_auto_x2.jpeg?fit=300%2C300&ssl=1","url":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2024\/09\/zaf_auto_x2.jpeg?fit=300%2C300&ssl=1","contentUrl":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2024\/09\/zaf_auto_x2.jpeg?fit=300%2C300&ssl=1","width":300,"height":300,"caption":"Zaf"},"logo":{"@id":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2024\/09\/zaf_auto_x2.jpeg?fit=300%2C300&ssl=1"},"sameAs":["http:\/\/zaf.web.id","http:\/\/www.facebook.com\/23Pstars","https:\/\/x.com\/23Pstars"],"url":"https:\/\/zaf.web.id\/blog\/author\/zaf\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2020\/08\/Screenshot-2024-09-06-at-00.22.03.png?fit=2150%2C1456&ssl=1","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1504,"url":"https:\/\/zaf.web.id\/blog\/dump-dan-backup-mysql-ke-s3-digitalocean-spaces\/","url_meta":{"origin":1501,"position":0},"title":"Dump dan Backup MySQL ke S3 DigitalOcean Spaces","author":"Zaf","date":"September 9, 2021","format":false,"excerpt":"Alur untuk backup otomatis database langsung ke S3 services, salah satunya ke DigitalOcean (DO) Spaces Integrasi s3cmd Download sesuai platform dari https:\/\/s3tools.org\/s3cmd kemudian jalankan comman untuk konfigurasi : s3cmd --configure Lengkapi credentials sehingga dapat terhubung dengan S3 service Script untuk Dump and Push Buat sebuah file dengan nama do.sh berisi\u2026","rel":"","context":"dalam &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/zaf.web.id\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2021\/09\/Screenshot-from-2021-09-09-14-15-14.png?fit=769%2C311&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2021\/09\/Screenshot-from-2021-09-09-14-15-14.png?fit=769%2C311&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2021\/09\/Screenshot-from-2021-09-09-14-15-14.png?fit=769%2C311&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2021\/09\/Screenshot-from-2021-09-09-14-15-14.png?fit=769%2C311&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":981,"url":"https:\/\/zaf.web.id\/blog\/serangan-adware-via-htaccess\/","url_meta":{"origin":1501,"position":1},"title":"Serangan Adware via .htaccess","author":"Zaf","date":"Desember 17, 2016","format":false,"excerpt":"Bukan pertama kalinya beberapa server kami mendapatkan serangan dengan teknik yang berbagai macam jenis, bentuk, dan dampaknya. Pagi ini\u00a0sempat kaget karena semua website yang ada dalam server Gili Air\u00a0kami diarahkan ke situs iklan ketika diakses dari perangkat mobile. Saat ditelusuri ternyata semua file .htaccess nya telah disusupi semua, untuk mendeteksi\u2026","rel":"","context":"dalam &quot;Server&quot;","block_context":{"text":"Server","link":"https:\/\/zaf.web.id\/blog\/category\/server\/"},"img":{"alt_text":".htaccess malware inject","src":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2016\/12\/Screen-Shot-2016-12-15-at-5.34.42-PM-1024x680.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2016\/12\/Screen-Shot-2016-12-15-at-5.34.42-PM-1024x680.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2016\/12\/Screen-Shot-2016-12-15-at-5.34.42-PM-1024x680.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1954,"url":"https:\/\/zaf.web.id\/blog\/mitigasi-malware-di-web-server-dan-cara-membersihkannya\/","url_meta":{"origin":1501,"position":2},"title":"Mitigasi Malware di Web Server dan Cara Membersihkannya","author":"Zaf","date":"November 23, 2022","format":false,"excerpt":"Malware selalu menjadi hal yang merepotkan. Umumnya pembuat malware tidak membuat malware untuk sekedar ajang pamer layaknya defacement. Malware dibuat demi tujuan yang lebih besar dan masif, dan biasanya tidak berjalan secara sendiri-sendiri melainkan menjadi sebuah network atau perkumpulan. Discovery Disuatu pagi tiba-tiba salah satu website yang kami kelola menunjukkan\u2026","rel":"","context":"dalam &quot;Security&quot;","block_context":{"text":"Security","link":"https:\/\/zaf.web.id\/blog\/category\/security\/"},"img":{"alt_text":"Mencari induk malware","src":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2022\/11\/6.-cari-dan-hapus-file-ico.png?fit=795%2C241&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2022\/11\/6.-cari-dan-hapus-file-ico.png?fit=795%2C241&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2022\/11\/6.-cari-dan-hapus-file-ico.png?fit=795%2C241&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2022\/11\/6.-cari-dan-hapus-file-ico.png?fit=795%2C241&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":1885,"url":"https:\/\/zaf.web.id\/blog\/code-inception-kemudahan-upgrade-versi-php-di-phpstorm\/","url_meta":{"origin":1501,"position":3},"title":"Code Inception: Kemudahan Upgrade Versi PHP di PhpStorm","author":"Zaf","date":"September 26, 2022","format":false,"excerpt":"Upgrade selalu menjadi mimpi buruk bagi seorang developer, tidak lepas juga bagi seorang web engineer. Performance dan security menjadi dua aspek yang sangat dipertimbangkan. Perubahan antar versi di PHP secara teknis dapat diketahui, apa saja fitur-fitur baru dan apa saja fitur-fitur yang sudah deprecated. Namun jika harus memeriksa satu persatu\u2026","rel":"","context":"dalam &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/zaf.web.id\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-26-at-18.54.35.png?fit=1200%2C725&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-26-at-18.54.35.png?fit=1200%2C725&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-26-at-18.54.35.png?fit=1200%2C725&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-26-at-18.54.35.png?fit=1200%2C725&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-26-at-18.54.35.png?fit=1200%2C725&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":791,"url":"https:\/\/zaf.web.id\/blog\/update-source-otomatis-dari-bitbucket-dan-github\/","url_meta":{"origin":1501,"position":4},"title":"Update Source otomatis dari Bitbucket dan GitHub","author":"Zaf","date":"Mei 22, 2016","format":false,"excerpt":"Siapa yang tidak kenal kedua GIT repository tersebut, dengan semua fasilitas yang\u00a0disediakan oleh Bitbucket dan GitHub membuat para developer nyaman untuk menitipkan source project mereka disana. Saya\u00a0menggunakan Bitbucket cukup lama, hanya baru-baru ini mulai menggunakan GitHub. Mengingat\u00a0kebijakan pricing yang diterapkan kedua layanan tersebut sedikit berbeda, untuk versi free Bitbucket memungkinkan\u2026","rel":"","context":"dalam &quot;Coretan&quot;","block_context":{"text":"Coretan","link":"https:\/\/zaf.web.id\/blog\/category\/coretan\/"},"img":{"alt_text":"Bitbucket and GitHub","src":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2015\/12\/github-bitbucket-300x172.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":484,"url":"https:\/\/zaf.web.id\/blog\/serangan-campaign-malware\/","url_meta":{"origin":1501,"position":5},"title":"Serangan Campaign Malware","author":"Zaf","date":"Desember 18, 2014","format":false,"excerpt":"Hari ini dipenghujung tahun 2014 ini adalah hari paling merepotkan selama mengelola salah satu Cloud milik LRsoft.\u00a0Pasalnya server mendapat kado natal istimewa berupa malware yang menginfeksi 60 lebih website yang\u00a0ada didalamnya, sehingga ketika domain web tersebut diakses via browser akan muncul peringatan block halaman dari layanan Google seperti gambar dibawah:\u2026","rel":"","context":"dalam &quot;Server&quot;","block_context":{"text":"Server","link":"https:\/\/zaf.web.id\/blog\/category\/server\/"},"img":{"alt_text":"Block dari Google","src":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2014\/12\/malware-frommshead.php_.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2014\/12\/malware-frommshead.php_.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/zaf.web.id\/blog\/wp-content\/uploads\/2014\/12\/malware-frommshead.php_.png?resize=525%2C300 1.5x"},"classes":[]}],"jetpack_likes_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4zLnS-od","_links":{"self":[{"href":"https:\/\/zaf.web.id\/blog\/wp-json\/wp\/v2\/posts\/1501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zaf.web.id\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zaf.web.id\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zaf.web.id\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zaf.web.id\/blog\/wp-json\/wp\/v2\/comments?post=1501"}],"version-history":[{"count":4,"href":"https:\/\/zaf.web.id\/blog\/wp-json\/wp\/v2\/posts\/1501\/revisions"}],"predecessor-version":[{"id":1841,"href":"https:\/\/zaf.web.id\/blog\/wp-json\/wp\/v2\/posts\/1501\/revisions\/1841"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zaf.web.id\/blog\/wp-json\/wp\/v2\/media\/2094"}],"wp:attachment":[{"href":"https:\/\/zaf.web.id\/blog\/wp-json\/wp\/v2\/media?parent=1501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zaf.web.id\/blog\/wp-json\/wp\/v2\/categories?post=1501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zaf.web.id\/blog\/wp-json\/wp\/v2\/tags?post=1501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}