-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from ylnb91/master
合并到主分支
- Loading branch information
Showing
3 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<#include "/layout/admin/_layout.html" /> | ||
<@head title="首页|四眼井|互联网人的乐园 "> | ||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> | ||
<script src="/upload/jquery.uploadify.min.js" type="text/javascript"></script> | ||
<link rel="stylesheet" type="text/css" href="/upload/uploadify.css"> | ||
<style type="text/css"> | ||
body { | ||
font: 13px Arial, Helvetica, Sans-serif; | ||
} | ||
</style> | ||
</@head> | ||
<@body> | ||
<form> | ||
<div id="queue"></div> | ||
<input id="file_upload" name="file_upload" type="file" multiple="true"> | ||
</form> | ||
|
||
</@body> | ||
<@script> | ||
<script type="text/javascript"> | ||
$(function() { | ||
$('#file_upload').uploadify({ | ||
'swf' : '/upload/uploadify.swf', | ||
'uploader' : 'upload/img' | ||
}) | ||
}); | ||
</script> | ||
</@script> |
This file contains 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.
Learn more about bidirectional Unicode characters
This file contains 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.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package me.thinkjet.controller.admin; | ||
|
||
import java.io.File; | ||
|
||
import me.thinkjet.service.upyun.UploadService; | ||
|
||
import com.jfinal.core.Controller; | ||
import com.jfinal.ext.route.ControllerBind; | ||
|
||
@ControllerBind(controllerKey = "/admin/upload", viewPath = "admin/") | ||
public class UploadController extends Controller { | ||
|
||
public void index() { | ||
render("upload.html"); | ||
} | ||
|
||
public void img() { | ||
File file = this.getFile().getFile(); | ||
String url = UploadService.uplaodImgToLocal(file); | ||
if (file.exists()) | ||
file.delete(); | ||
if (url != null) { | ||
this.setAttr("error", 0); | ||
this.setAttr("url", url); | ||
} else { | ||
this.setAttr("error", 1); | ||
} | ||
this.renderJson(); | ||
} | ||
|
||
} |