{"id":1514,"date":"2024-04-06T21:46:47","date_gmt":"2024-04-07T00:46:47","guid":{"rendered":"https:\/\/blog.galsoft.com.ar\/?p=1514"},"modified":"2024-04-06T21:47:13","modified_gmt":"2024-04-07T00:47:13","slug":"uploads-archivos-con-livewire-falla-en-produccion","status":"publish","type":"post","link":"https:\/\/blog.galsoft.com.ar\/?p=1514","title":{"rendered":"Uploads archivos con livewire falla en producci\u00f3n"},"content":{"rendered":"<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Soluci\u00f3n<\/p>\n<\/blockquote>\n<ol class=\"wp-block-list\">\n<li>Ve a\u00a0<code>vendor\/livewire\/livewire\/src\/Controllers\/FileUploadHandler.php<\/code> y comenta esta l\u00ednea <code>abort_unless(request()-&gt;hasValidSignature(), 401);<\/code><\/li>\n\n<li>Vaya a\u00a0<code>vendor\/livewire\/livewire\/src\/TemporaryUploadedFile.php<\/code>y en lugar de esto\u00a0<code>$tmpfile = tmpfile();<\/code>, escriba esto:<code> $tmpfname = tempnam(sys_get_temp_dir(), &#039;&#039;); $tmpFile = fopen($tmpfname, &#039;w&#039;);<\/code><\/li>\n\n<li>Vaya a la carpeta\u00a0<code>public<\/code> de su aplicaci\u00f3n y cree el directorio\u00a0<code>livewire<\/code>. (\u00a0<code>mkdir livewire<\/code>) Despu\u00e9s de eso, vaya a ese directorio y desde all\u00ed crear\u00e1 un enlace simb\u00f3lico que apuntar\u00e1\u00a0<code>public\/livewire\/preview-file<\/code> al directorio <code>storage\/app\/public\/livewire-tmp<\/code> de su aplicaci\u00f3n:<\/li>\n<\/ol>\n<p><code>ln -s preview-file ..\/..\/storage\/app\/public\/livewire-tmp<\/code><\/p>\n<p>Y recuerde, debe otorgar 755 permisos a las carpetas que est\u00e1n dentro del directorio\u00a0<code>storage\/app\/public<\/code><\/p>\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Explicaci\u00f3n<\/p>\n<\/blockquote>\n<ol class=\"wp-block-list\">\n<li>Necesitamos comentar esa l\u00ednea, porque verifica si tiene\u00a0<code>ssl certificate<\/code> o no. En caso contrario, abortar\u00e1 la solicitud. Si tiene un certificado SSL, puede omitir este paso.<\/li>\n\n<li>En este paso, creamos\u00a0<code>temporary file<\/code> y damos acceso de escritura.<\/li>\n\n<li>El \u00faltimo paso es simplemente crear un archivo\u00a0<code>symbolic link<\/code>. Necesitamos crear esto\u00a0<code>symbolic link<\/code> porque, al cargar un archivo, Livewire crea un archivo temporal con esa URL.<\/li>\n<\/ol>\n<p>Fuente: https:\/\/stackoverflow.com\/questions\/73294167\/livewire-image-upload-fails-on-production-server<\/p>","protected":false},"excerpt":{"rendered":"<p>Soluci\u00f3n ln -s preview-file ..\/..\/storage\/app\/public\/livewire-tmp Y recuerde, debe otorgar 755 permisos a las carpetas que est\u00e1n dentro del directorio\u00a0storage\/app\/public Explicaci\u00f3n Fuente: <a href=\"https:\/\/stackoverflow.com\/questions\/73294167\/livewire-image-upload-fails-on-production-server\">https:\/\/stackoverflow.com\/questions\/73294167\/livewire-image-upload-fails-on-production-server<\/a><\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"footnotes":""},"categories":[9,10],"tags":[],"class_list":["post-1514","post","type-post","status-publish","format-standard","hentry","category-laravel","category-programacion","entry"],"_links":{"self":[{"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=\/wp\/v2\/posts\/1514","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1514"}],"version-history":[{"count":3,"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=\/wp\/v2\/posts\/1514\/revisions"}],"predecessor-version":[{"id":1517,"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=\/wp\/v2\/posts\/1514\/revisions\/1517"}],"wp:attachment":[{"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}