You need to sign in to do that
Don't have an account?
madhu l 1
[Error] Error: Compile Error: Initial term of field expression must be a concrete SObject: String at line 6 column 12
public class CountryClub {
public String imageURL{ get; set; }
public PageReference Upload() {
imageURL.AuthorId = UserInfo.getUserId();
imageURL.FolderId = UserInfo.getUserId(); // put it in running user's folder
try {
insert imageURL;
} catch (DMLException e) {
ApexPages.addimage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));
}
//Add more logic here
return null;
}
public PageReference Browse() {
imageURL.AuthorId = UserInfo.getUserId();
imageURL.FolderId = UserInfo.getUserId(); // put it in running user's folder
try {
insert imageURL;
} catch (DMLException e) {
ApexPages.addimage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));
}
//Add more logic here
return null;
}
}
hi guys please find this error below code
[Error] Error: Compile Error: Initial term of field expression must be a concrete SObject: String at line 6 column 12
public class CountryClub {
public String imageURL{ get; set; }
public PageReference Upload() {
imageURL.AuthorId = UserInfo.getUserId();
imageURL.FolderId = UserInfo.getUserId(); // put it in running user's folder
try {
insert imageURL;
} catch (DMLException e) {
ApexPages.addimage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));
}
//Add more logic here
return null;
}
public PageReference Browse() {
imageURL.AuthorId = UserInfo.getUserId();
imageURL.FolderId = UserInfo.getUserId(); // put it in running user's folder
try {
insert imageURL;
} catch (DMLException e) {
ApexPages.addimage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));
}
//Add more logic here
return null;
}
}
Issue in your code is that you are trying perform the DML (insert) on String. That is not possible. You can perform the DML on Sobject only. means on standard object or custom object.
Can you please confirm me on which object you want to insert ?
If you are trying ton insert the document object then please reffer below post. I hope that will help u
http://developer.force.com/cookbook/recipe/uploading-a-document-using-visualforce-and-a-custom-controller In your case in hope can try below code:- Please let us know if this will help you
Thanks
Amit Chaudhary
can you explain about "document.AuthorId = UserInfo.getUserId(); document.FolderId = UserInfo.getUserId(); ".
you are putting user id in author id and folder id both.
thanks,
geeta garg