| [5] | 1 | <cfsetting enablecfoutputonly=true> |
|---|
| 2 | <cfprocessingdirective pageencoding="utf-8"> |
|---|
| 3 | <!--- |
|---|
| 4 | Name : /client/admin/imgwin.cfm |
|---|
| 5 | Author : Raymond Camden |
|---|
| 6 | Created : 9/15/06 |
|---|
| 7 | Last Updated : 12/14/06 |
|---|
| 8 | History : Use imageroot (rkc 12/14/06) |
|---|
| 9 | ---> |
|---|
| 10 | |
|---|
| 11 | <cfif len(application.imageroot)> |
|---|
| 12 | <cfset sImgRoot = "../" & application.imageroot /> |
|---|
| 13 | <cfelse> |
|---|
| 14 | <cfset sImgRoot = "../images/" /> |
|---|
| 15 | </cfif> |
|---|
| 16 | |
|---|
| 17 | <cfset sImgRoot = application.utils.fixUrl(sImgRoot) /> |
|---|
| 18 | <cfset imageDirectory = expandPath(sImgRoot) /> |
|---|
| 19 | |
|---|
| 20 | <cfif structKeyExists(form, "upload") and len(trim(form.newimage))> |
|---|
| 21 | |
|---|
| 22 | <cfif not directoryExists(imageDirectory)> |
|---|
| 23 | <cfdirectory action="create" directory="#imageDirectory#"> |
|---|
| 24 | </cfif> |
|---|
| 25 | |
|---|
| 26 | <cffile action="upload" filefield="form.newimage" destination="#imageDirectory#" nameconflict="makeunique"> |
|---|
| 27 | |
|---|
| 28 | <cfif not listFindNoCase("gif,jpg,png", cffile.serverFileExt)> |
|---|
| 29 | <cfset notImageFlag = true> |
|---|
| 30 | <cffile action="delete" file="#cffile.serverDirectory#/#cffile.serverFile#"> |
|---|
| 31 | <cfelse> |
|---|
| 32 | <cfset fileName = cffile.serverFile> |
|---|
| 33 | <cfoutput> |
|---|
| 34 | <script> |
|---|
| 35 | opener.newImage('#jsStringFormat(filename)#'); |
|---|
| 36 | window.close(); |
|---|
| 37 | </script> |
|---|
| 38 | </cfoutput> |
|---|
| 39 | <cfabort> |
|---|
| 40 | </cfif> |
|---|
| 41 | |
|---|
| 42 | </cfif> |
|---|
| 43 | |
|---|
| 44 | <cfif structKeyExists(variables, "notImageFlag")> |
|---|
| 45 | <cfoutput> |
|---|
| 46 | File upload wasn't a valid image. |
|---|
| 47 | </cfoutput> |
|---|
| 48 | </cfif> |
|---|
| 49 | |
|---|
| 50 | <cfoutput> |
|---|
| 51 | <form action="imgwin.cfm" method="post" enctype="multipart/form-data"> |
|---|
| 52 | <input type="file" name="newimage"> <input type="submit" name="upload" value="Upload Image"> |
|---|
| 53 | </form> |
|---|
| 54 | </cfoutput> |
|---|
| 55 | |
|---|
| 56 | <cfsetting enablecfoutputonly=false> |
|---|