Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Need help with uploading images

New Here ,
Feb 03, 2009 Feb 03, 2009
I have a site at nysportsface.com built with Coldfusion 8 code. A feature we tried implementing is a photo gallery where users could upload their images into their team profiles. The images are not uploading most of the time and nothing shows up. An example of the problem can be seen at Text

If anyone knows a programmer or think they can help please let me know.
504
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 03, 2009 Feb 03, 2009
instead of posting a link to your non-working page, post your CODE, both
for uploading the images and for displaying them.

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 03, 2009 Feb 03, 2009
This is the photos upload page.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 04, 2009 Feb 04, 2009
you need to also post code of your 'photosForm.cfm' page - the page with
the custom cfgrid you posted does not have the file upload code in it...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 03, 2009 Feb 03, 2009
Code from the page that you view photos

<cfset teamsGateway = CreateObject("component", APPLICATION.componentPath & "dataobjects.teamsGateway").init(#APPLICATION.dsn#) />
<cfset photosGateway = CreateObject("component", APPLICATION.componentPath & "dataobjects.photosGateway").init(#APPLICATION.dsn#) />
<cfset galleriesGateway = CreateObject("component", APPLICATION.componentPath & "dataobjects.galleriesGateway").init(#APPLICATION.dsn#) />

<cfset qTeamInfo = teamsGateway.getByAttributes(url.teamID) />
<cfset qPhotogalleries = galleriesGateway.getByAttributes('',url.teamID,'',1,'',1,'galleryName') />
<cfif isDefined('url.gallery')>
<cfset qphotos = photosGateway.getByAttributes('',url.teamID,url.gallery) />
<cfset qPhotoGalleryName = galleriesGateway.getByAttributes(url.gallery) />
</cfif>


<cfsavecontent variable="scriptLinks">
<cfoutput>
<link rel="stylesheet" href="#APPLICATION.dirpath#/css/lightbox.css" type="text/css" media="screen" />

<script src="#APPLICATION.dirpath#/js/prototype.js" type="text/javascript"></script>
<script src="#APPLICATION.dirpath#/js/scriptaculous.js?load=effects,builder" type="text/javascript"></script>
<script src="#APPLICATION.dirpath#/js/lightbox.js" type="text/javascript"></script>
</cfoutput>
</cfsavecontent>

<cfhtmlhead text="#scriptLinks#">

<cfinclude template="includes/head.cfm">
<script type="text/javascript">
function openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
</script>

<div id="teamMenu">
<cfoutput query="qTeamInfo">
<table border="0" width="100%">
<tr>
<td width="100">
<cfset logoPath = expandpath('assets/profileImages/' & #url.teamID# & '/teamLogo.gif')>
<cfif FileExists("#logoPath#") is "Yes">
<img src="#APPLICATION.dirpath#/assets/profileImages/#teamID#/teamLogo.gif" border="0" align="absmiddle" hspace="5"/>
</cfif> </td>
<td>
<span class="teamName" style="color:#logoColor#; font-size:32px; font-weight:bold;"><cfoutput>#name#</cfoutput></span>
</td>
</tr> <tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" align="right">
<img src="assets/images/teamPhotoMenu.gif" border="0" usemap="##Map" hspace="5"/>
</td>
</tr>
</table>
<map name="Map" id="Map">
<area shape="rect" coords="0,0,103,26" href="teamHome.cfm?teamid=#teamID#" />
<area shape="rect" coords="103,3,200,26" href="teamInfo.cfm?teamid=#teamID#" />
<area shape="rect" coords="200,3,294,27" href="teamphotos.cfm?teamid=#teamID#" />
<area shape="rect" coords="293,3,393,25" href="teamvideos.cfm?teamid=#teamID#" />
</map>
</cfoutput>
</div>

<cfif isDefined('url.gallery')>
<div id="teamPods">
<div id="xteamPods">
<b class="tBoxtop"><b class="tBoxb1"></b><b class="tBoxb2"></b><b class="tBoxb3"></b><b class="tBoxb4"></b></b>
<div class="teamPodsContent">
<cfoutput><h3>#qPhotoGalleryName.galleryName#</h3></cfoutput>
<cfoutput query="qphotos">
<a href="#APPLICATION.dirpath#/assets/profileimages/#qTeamInfo.teamID#/galleryphotos/#filename#" rel="lightbox[#galleryID#]" title="#description#">
<img src="#APPLICATION.dirpath#/assets/profileimages/#qTeamInfo.teamID#/galleryThumbnails/#filename#" hspace="5" vspace="5" border="0"/>
</a>
</cfoutput>
</div> <!-- teamPodsContent -->
<b class="tBoxbottom"><b class="tBoxb4"></b><b class="tBoxb3"></b><b class="tBoxb2"></b><b class="tBoxb1"></b></b>
</div> <!-- xteamPods -->
</div> <!-- teamPods -->
</cfif>

<div id="teamPods">
<div id="xteamPods">
<b class="tBoxtop"><b class="tBoxb1"></b><b class="tBoxb2"></b><b class="tBoxb3"></b><b class="tBoxb4"></b></b>
<div class="teamPodsContent">
<cfif qPhotogalleries.recordcount GTE 1>
<h3>Choose a gallery</h3>
<cfoutput query="qPhotogalleries">
<a href="#cgi.SCRIPT_NAME#?gallery=#galleryID#&teamID=#url.teamID#">
#galleryName#
</a><br/><br/>
</cfoutput>
<cfelse>
<div id="siteNotification">
No photo galleries have been created.
</div>
</cfif>
</div> <!-- teamPodsContent -->
<b class="tBoxbottom"><b class="tBoxb4"></b><b class="tBoxb3"></b><b class="tBoxb2"></b><b class="tBoxb1"></b></b>
</div> <!-- xteamPods -->
</div> <!-- teamPods -->

<cfinclude template="includes/foot.cfm">
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 04, 2009 Feb 04, 2009
LATEST
code you mentioned. (photosform.cfm)

<cfinclude template="../includes/head.cfm">
<cfsavecontent variable="headerInfo">
<script type="text/javascript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</cfsavecontent>

<cfhtmlhead text="#headerInfo#">

<cfprocessingdirective suppresswhitespace="true">
<!---
TEMPLATE: photosForm.cfm
AUTHOR: Jason Presley DATE: 12/20/08 PURPOSE: Receive an object passed from the photos form and send it to the correct CRUD method of the DAO cfc.
FILE LOCATION: This file should be placed in the admin folder under the root CHANGE HISTORY:
* 12/20/2008: template created (Jason Presley via generator)
--->
<!--- defaults for id and struct to hold data --->
<cfparam name="url.photoID" type="string" default="" />
<cfparam name="url.action" type="string" default="Add" />
<cfparam name="url.start" type="numeric" default="1" />

<!--- get instance of DAO --->
<cfset photosDAO = CreateObject("component", APPLICATION.componentPath & "dataobjects.photosDAO").init(Application.dsn) />
<cfset photosGateway = CreateObject("component", APPLICATION.componentPath & "dataobjects.photosGateway").init(#APPLICATION.dsn#) />
<cfset galleriesGateway = CreateObject("component", APPLICATION.componentPath & "dataobjects.galleriesGateway").init(#APPLICATION.dsn#) />

<cfset qPhotogalleries = galleriesGateway.getByAttributes('',SESSION.manager.teamID,'',1,'',1,'galleryName') />
<cfset qPhoto = photosGateway.getByAttributes(url.photoID) />

<!--- if there isn't already a photos in the request scope, get the photos --->
<cfif Not StructKeyExists(request, "photos")>
<cfset request.photos = CreateObject("component", APPLICATION.componentPath & "beans.photos").init(url.photoID) />
<cfset photosDAO.readRecord(request.photos) />
</cfif>

<!--- if we have an id in either the URL or the bean, we're doing an update --->
<cfif url.photoID NEQ "" OR request.photos.getphotoID() NEQ "">
<cfif url.action EQ "delete">
<cfset url.action = "delete">
<cfelse>
<cfset url.action = "Update" />
</cfif>
</cfif>

<!--- output errors if they exist --->
<cfif StructKeyExists(request, "errors")>
<p style="color:red;"><strong>The following errors occurred:</strong></p>

<cfloop collection="#request.errors#" item="error">
<ul>
<cfoutput><li>#request.errors[error]#</li></cfoutput>
</ul>
</cfloop>
</cfif>

<!--- output message if one exists --->
<cfif StructKeyExists(request, "message")>
<cfoutput><p style="color:blue;"><strong>#request.message#</strong></p></cfoutput>
</cfif>


<!--- begin form here --->
<cfoutput>
<div align="center"><h2>#ucase(url.action)# #ucase("photos")#</h2></div>
<p> </p>


<cfif cgi.HTTP_HOST EQ "localhost">
<cfset baseImgPath = "/#APPLICATION.localhostFolderName#/">
</cfif>
<cfform action="controllers/photosController.cfm" method="post" width="700" height="200" name="photos" enctype="multipart/form-data">
<table width="500" align="center">

<!--- looping over fields in database to create form fields --->
<tr>
<td valign="top" style="font-weight:bold;">Gallery</td>
<td>
<a href="##" onClick="MM_openBrWindow('galleriesFormCondensed.cfm?teamID=#SESSION.manager.teamID#&photo=true','GalleryWin','width=500,height=100,scrollbars=no')">Create a New Gallery</a><br/>
<cfselect name="galleryID" required="yes" message="Selecting a gallery is required">
<cfloop query="qPhotogalleries">
<option value="#qPhotogalleries.galleryID#" <cfif #request.photos.getgalleryID()# EQ #qPhotogalleries.galleryID#>selected</cfif>>#qPhotogalleries.galleryName#</option>
</cfloop>
</cfselect>
</td>
</tr>
<tr>
<td valign="top" style="font-weight:bold;">Picture</td>
<td>
<cfif action NEQ "add">
<input type="text" disabled="disabled" value="#qPhoto.filename#" />
<input type="hidden" name="filename" value="#qPhoto.filename#" />
<cfelse>
<input type="file" name="fileUpload">
</cfif>
</td>
</tr>
<tr>
<td valign="top">Description (120 characters max)</td>
<td>
<cfinput type="text" name="description" size="50" maxlength="120" value="#request.photos.getdescription()#" />
</td>
</tr>

<!--- end looping over fields in database to create form fields --->

<!--- insert hidden fields and determine/create submit button action --->
<tr>
<td> </td>
<td>
<input type="hidden" name="start" value="#url.start#" /> <input type="hidden" name="teamID" value="#SESSION.manager.teamID#" />
<input type="hidden" name="photoID" value="#request.photos.getphotoID()#" />
<cfswitch expression="#url.action#">
<cfcase value="add">
<input type="submit" name="action" value="Add"/>
</cfcase>
<cfcase value="update">
<input type="submit" name="action" value="Update" />
</cfcase>
<cfcase value="delete">
<input type="submit" name="action" value="Delete" onClick="return confirm('Are you sure you want to delete this record from the database?')"/>
</cfcase>
</cfswitch>
<!--- end hidden field and submit button creation --->

</td>
</tr>
</table>
</cfform>
</cfoutput>
</cfprocessingdirective>


<cfinclude template="../includes/foot.cfm">


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources