×ðÁú¿­Ê±

laravel ÎļþÉÏ´«Ê§°Ü

ÔÚʹÓà laravel ¿ª·¢ web Ó¦ÓÃʱ£¬¾­³£ÐèÒª¾ÙÐÐÎļþÉÏ´«¡£¿ÉÊÇ£¬ÓÐʱÉÏ´«Îļþ»áʧ°Ü£¬µ¼Ö¿ª·¢Àú³Ì±äµÃÄÑÌâ¡£±¾ÎĽ«ÏÈÈݼ¸ÖÖ³£¼ûµÄÎļþÉÏ´«Ê§°ÜµÄÔµ¹ÊÔ­ÓÉÏ¢Õù¾öÒªÁì¡£

ÉÏ´«ÎļþÁè¼ÝÁË php.ini ÖеÄÉèÖÃ

ÔÚ php.ini ÎļþÖУ¬ÓÐһЩÉèÖÃÓëÎļþÉÏ´«ÓйØ£¬ÀýÈç upload_max_filesize ºÍ post_max_size¡£ÈôÊÇÉÏ´«µÄÎļþ¾ÞϸÁè¼ÝÁËÕâЩÉèÖÃËùÔÊÐíµÄ¹æÄ££¬ÎļþÉÏ´«¾Í»áʧ°Ü¡£Òª½â¾öÕâ¸öÎÊÌ⣬¿ÉÒÔÐÞ¸Ä php.ini ÎļþÖÐÏìÓ¦µÄÉèÖ㬽«Æäµ÷´óµ½ÉÏ´«µÄÎļþ¾Þϸ¹æÄ£ÄÚ¼´¿É¡£Ð޸ĺó¼ÇµÃÖØÆô Apache »òÆäËû web ЧÀÍÆ÷£¬²»È»Ð޸IJ»»áÉúЧ¡£

±íµ¥Ã»ÓÐÉèÖÃ׼ȷµÄ enctype ÊôÐÔ

µ±Ê¹ÓÃ±íµ¥ÉÏ´«Îļþʱ£¬Òª¼ÇµÃÉèÖÃ±íµ¥µÄ enctype ÊôÐÔΪ “multipart/form-data”¡£ÈôÊÇûÓÐÉèÖã¬ÎļþÉÏ´«Ò²»áʧ°Ü¡£ÔÚ Laravel ÖУ¬¿ÉÒÔͨ¹ý Blade Ä£°åÒýÇæµÄ form ¸¨Öúº¯ÊýÉèÖÃ±íµ¥µÄ enctype ÊôÐÔ£º

{!! Form::open(['url' => '/upload', 'method' => 'POST', 'files' => true, 'enctype' => 'multipart/form-data']) !!}
// ±íµ¥Î»ËØ
{!! Form::close() !!}

µÇ¼ºó¸´ÖÆ

×¢ÖØÕâÀﻹÐèÒªÉèÖà ‘files’ => true£¬ÌåÏÖ±íµ¥ÖаüÀ¨ÎļþÉÏ´«¡£

Ä¿µÄÎļþ¼ÐûÓÐ׼ȷÉèÖÃȨÏÞ

µ±ÉÏ´«Îļþʱ£¬Laravel »á½«ÎļþÉúÑĵ½Ö¸¶¨µÄÄ¿µÄÎļþ¼ÐÖС£ÈôÊǸÃĿ¼ûÓÐдÈëȨÏÞ£¬ÎļþÉÏ´«½«Ê§°Ü¡£Òª½â¾öÕâ¸öÎÊÌ⣬¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîΪĿµÄÎļþ¼ÐÉèÖÃ׼ȷµÄȨÏÞ£º

chmod -R 777 /path/to/upload/folder

µÇ¼ºó¸´ÖÆ

×¢ÖØÕâÀï¸øÄ¿µÄÎļþ¼Ð¸¶ÓëÁË 777 µÄȨÏÞ£¬ÕâÒâζ×ÅËùÓÐÓû§¶¼¿ÉÒÔ¶ÔÆä¾ÙÐжÁд²Ù×÷£¬¿ÉÄܱ£´æÇ徲Σº¦£¬Çëƾ֤ÏÖÕæÏàÐÎÉèÖúÏÀíµÄȨÏÞ¡£

ÎļþÉÏ´«±»Ð§ÀÍÆ÷ÏÞÖÆ

ÓÐЩ web ЧÀÍÆ÷»áÏÞÖÆÎļþÉÏ´«£¬ÀýÈç Nginx ĬÈÏÏÞÖÆÉÏ´«Îļþ¾ÞϸΪ 1MB¡£Òª½â¾öÕâ¸öÎÊÌ⣬¿ÉÒÔͨ¹ýÐÞ¸Ä Nginx ÉèÖÃÎļþÖÐµÄ client_max_body_size À´µ÷½âÉÏ´«Îļþ¾ÞϸÏÞÖÆ£º

client_max_body_size 20M;

µÇ¼ºó¸´ÖÆ

×¢ÖØÕâÀォÉÏ´«Îļþ¾ÞϸÏÞÖÆÉèÖÃΪ 20MB£¬¿ÉÒÔƾ֤ÐèÒª¾ÙÐе÷½â¡£

ÎļþÉÏ´«±»ÒÔΪÊǶñÒâ¹¥»÷

ÓÐЩ web Ó¦ÓõÄЧÀÍÆ÷»á¶ÔÉÏ´«µÄÎļþ¾ÙÐÐÇå¾²¼ì²é£¬ÈôÊÇÒÔΪÉÏ´«µÄÎļþ¿ÉÄÜÊǶñÒâµÄ£¬ÉÏ´«¾Í»áʧ°Ü¡£Òª½â¾öÕâ¸öÎÊÌ⣬¿ÉÒÔƾ֤ЧÀÍÆ÷µÄÈÕÖ¾ÆÊÎöÉÏ´«Ê§°ÜµÄÔµ¹ÊÔ­ÓÉ£¬²éÕÒÉÏ´«ÎļþÖпÉÄܱ£´æµÄΣÏÕÒòËØ£¬ÀýÈ粡¶¾¡¢²»·¨´úÂ롢ľÂíµÈ¡£

×ܽá

ÎļþÉÏ´«Ê§°ÜÓжàÖÖÔµ¹ÊÔ­ÓÉ£¬²¢²»ÊÇËùÓÐÇéÐζ¼¿ÉÒÔͨ¹ýÉÏÊöÒªÁì½â¾ö¡£ÔÚ¿ª·¢Àú³ÌÖУ¬¿ÉÒÔͨ¹ý¼Í¼ÈÕÖ¾ºÍµ÷ÊÔÀ´²éÕÒÎļþÉÏ´«Ê§°ÜµÄÔµ¹ÊÔ­ÓÉ£¬²¢Æ¾Ö¤²î±ðµÄÇéÐνÓÄÉÏìÓ¦µÄ½â¾öÒªÁì¡£ÈôÊÇÄ㻹Óöµ½ÆäËûÎļþÉÏ´«Ê§°ÜµÄÎÊÌ⣬½Ó´ýÔÚ̸ÂÛÇøÁôÑÔ£¬ÎÒÃÇÒ»ÆðÀ´Ì½ÌÖ£¡

ÒÔÉϾÍÊÇlaravel ÎļþÉÏ´«Ê§°ÜµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿