<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
	<channel>
				<title><![CDATA[자작 플러그인에 파일 업로드 어떻게 하나요?  ]]></title>
		<link>https://www.cosmosfarm.com/threads/rss/document/15522</link>
		<description><![CDATA[<p>안녕하세요.</p>

<p>제가 대충 플러그인을 만든다고 하다가 그냥 워드프레스 플러그인 인척 하고 관리자 페이지 메뉴에 나오게 하고 인클루드 해서 페이지가 오른쪽에 웹 형식으로 보이게 작업을 했습니다.</p>

<p>db연동을 할때 ajax로 해서 자료를 주고 받는건 잘 됐는데 지금 파일 업로드에서 막혀 버렸습니다.</p>

<p>html 에서 타입 file 을 주고 파일 업로드 다운로드 할 수 있나요?? 도와주세요 ㅜㅜ</p>
]]></description>
		<copyright>Copyright 2026, 코스모스팜</copyright>
				<item>
			<title><![CDATA[너무 감사합니다. 대충은 해결이 된듯 합니다 ㅜㅜ

그런데 다운로드는 어떻게 하나요? 아무리 찾아봐도...]]></title>
			<link>https://www.cosmosfarm.com/threads/document/15537</link>
			<description><![CDATA[<p>너무 감사합니다. 대충은 해결이 된듯 합니다 ㅜㅜ</p>

<p>그런데 다운로드는 어떻게 하나요? 아무리 찾아봐도 안나오네요 </p>

<p>&lt;a&gt; 태그를 줘서 하면 웹에만 보이고 다운로드는 안되네요 ㅜㅜ 다른방법이 있나요?</p>
]]></description>
			<author>g***</author>
			<pubDate>Thu, 24 Aug 2017 02:11:08 +0000</pubDate>
			<category>워드프레스</category>
		</item>
				<item>
			<title><![CDATA[안녕하세요~^^

워드프레스의 wp_handle_upload() 함수를 사용해보세요.

https://codex.wordpress.org/...]]></title>
			<link>https://www.cosmosfarm.com/threads/document/15527</link>
			<description><![CDATA[<p>안녕하세요~^^</p>

<p>워드프레스의 wp_handle_upload() 함수를 사용해보세요.</p>

<p><a href="https://codex.wordpress.org/Function_Reference/wp_handle_upload" target="_blank">https://codex.wordpress.org/Function_Reference/wp_handle_upload</a></p>

<p> </p>

<p>아래 예제 코드도 올려드립니다.</p>

<pre>
<code class="language-php">if ( ! function_exists( 'wp_handle_upload' ) ) {
    require_once( ABSPATH . 'wp-admin/includes/file.php' );
}

$uploadedfile = $_FILES['file'];

$upload_overrides = array( 'test_form' =&gt; false );

$movefile = wp_handle_upload( $uploadedfile, $upload_overrides );

if ( $movefile &amp;&amp; ! isset( $movefile['error'] ) ) {
    echo "File is valid, and was successfully uploaded.\n";
    var_dump( $movefile );
} else {
    /**
     * Error generated by _wp_handle_upload()
     * @see _wp_handle_upload() in wp-admin/includes/file.php
     */
    echo $movefile['error'];
}</code></pre>

<p> </p>

<p>예제 코드에서 $_FILES['<strong>file</strong>']; 이 부분은</p>

<p>실제로 &lt;input type="file" name="<strong>file</strong>"&gt; 이것 처럼 input의 name과 일치시켜 주세요.</p>

<p> </p>

<p>form 태그에 enctype="multipart/form-data" 속성이 있는지 확인해보세요.</p>

<p>&lt;form enctype="multipart/form-data"&gt; 이런 형식입니다.</p>

<p>해당 속성 없이는 파일이 전송되지 않습니다.</p>

<p> </p>

<p>추가적으로 PHP의 파일 업로드 방식에 대해서 자세히 알아보셔야 할 듯합니다.</p>

<p><a href="http://php.net/manual/kr/features.file-upload.post-method.php" target="_blank">http://php.net/manual/kr/features.file-upload.post-method.php</a></p>

<p> </p>

<p>잘 해결되시길 바랍니다.</p>

<p>고맙습니다.</p>
]]></description>
			<author>스레드봇</author>
			<pubDate>Wed, 23 Aug 2017 09:06:55 +0000</pubDate>
			<category>워드프레스</category>
		</item>
			</channel>
</rss>